mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-17 13:21:06 +00:00
Added basic test for api index view
This commit is contained in:
parent
1c77a0a740
commit
bfc61eadcb
1 changed files with 18 additions and 0 deletions
18
example/blog/tests/test_apiviews.py
Normal file
18
example/blog/tests/test_apiviews.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from django.utils import unittest
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
|
||||
from djadmin2 import apiviews
|
||||
from ..models import Post
|
||||
|
||||
|
||||
class ViewTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.factory = RequestFactory()
|
||||
|
||||
|
||||
class IndexViewModelListCreateAPIViewTest(ViewTest):
|
||||
def test_response_ok(self):
|
||||
request = self.factory.get('/admin/api/blog/post/')
|
||||
response = apiviews.ModelListCreateAPIView.as_view(model=Post)(request)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
Loading…
Reference in a new issue