Add api tests for ModuleList
This commit is contained in:
parent
0b0d9b3830
commit
0522d3d3cc
@ -1,3 +1,13 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from store.models import Module, Version
|
||||||
|
|
||||||
|
class ApiModuleListTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
for name in ['module1', 'module2', 'module3']:
|
||||||
|
Module.objects.create(name=name)
|
||||||
|
def test_call_view_success(self):
|
||||||
|
response = self.client.get('/api/modules', follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertEqual(response['content-type'], 'application/json')
|
||||||
|
self.assertJSONEqual(response.content, {'modules': ['module1', 'module2', 'module3']})
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user