Skip to content

Commit

Permalink
Merge 0622175 into d5f44b4
Browse files Browse the repository at this point in the history
  • Loading branch information
lmmLucasMachado committed Sep 21, 2018
2 parents d5f44b4 + 0622175 commit 3f886af
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
39 changes: 39 additions & 0 deletions YoutubeService/API/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
from django.test import TestCase
from model_mommy import mommy
from YoutubeService.importdata.models import Game
from rest_framework.test import APITestCase, URLPatternsTestCase
from django.urls import include, path, reverse
from rest_framework import status

# Create your tests here.
class EndpointTestCase(APITestCase, URLPatternsTestCase):

urlpatterns= [
path('api/', include('YoutubeService.API.urls'))
]

def setUp(self):

self.Game_yotube = mommy.make(
Game,
id = 0,
name = "teste",
count_views = 0,
count_likes = 0,
)

self.youtube_endpoint = reverse('get_youtube_games_Name_list')

def tearDown(self):

Game.objects.all().delete()

def test_status_youtube_endpoint(self):

response = self.client.get(self.youtube_endpoint)
self.assertEqual(response.status_code, status.HTTP_200_OK)

def test_response_youtube_endpoint(self):

response = self.client.get(self.youtube_endpoint,format = 'json')

for data in response.data:
self.assertNotEqual(data['id'], None)
self.assertNotEqual(data['name'], None)
1 change: 0 additions & 1 deletion YoutubeService/importdata/fixtures/youtube_data.json

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ coverage
coveralls
djongo
djangorestframework==3.8.2

model_mommy

0 comments on commit 3f886af

Please sign in to comment.