django-admin2/example/blog/tests/test_apiviews.py
2013-05-19 14:16:15 +02:00

18 lines
515 B
Python

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)