API Game : ajout des champs status, unplayed, playing et wish
This commit is contained in:
@ -64,8 +64,8 @@ class GameTest(APITestCase):
|
||||
|
||||
url = reverse('game-list')
|
||||
data = {
|
||||
'name': 'Tetris',
|
||||
'collection': console_url,
|
||||
'name': 'Tetris',
|
||||
'collection': console_url,
|
||||
}
|
||||
self.client.force_authenticate(user=self.superuser)
|
||||
response = self.client.post(url, data, format='json')
|
||||
@ -98,3 +98,17 @@ class GameTest(APITestCase):
|
||||
games = [x.get('name') for x in json.loads(response.content)]
|
||||
self.assertEqual(games, sorted_games)
|
||||
|
||||
def test_not_allowed_status(self):
|
||||
"""
|
||||
Check that we cannot insert a not allowed status in a Game
|
||||
"""
|
||||
console = Platform.objects.create(name='BestPlatform4Ever')
|
||||
url = reverse('game-list')
|
||||
data = {
|
||||
'name': 'Vilebrequin',
|
||||
'status': 'wrecked',
|
||||
}
|
||||
self.client.force_authenticate(user=self.superuser)
|
||||
response = self.client.post(url, data, format='json')
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.assertEqual(Game.objects.count(), 0)
|
||||
|
Reference in New Issue
Block a user