diff --git a/backend/api/tests/api/test_document.py b/backend/api/tests/api/test_document.py index a0fd5b52..252010fc 100644 --- a/backend/api/tests/api/test_document.py +++ b/backend/api/tests/api/test_document.py @@ -12,7 +12,7 @@ class TestExampleListAPI(CRUDMixin): def setUp(self): self.project = prepare_project(task=DOCUMENT_CLASSIFICATION) self.non_member = make_user() - make_doc(self.project.item) + self.example = make_doc(self.project.item) self.data = {'text': 'example'} self.url = reverse(viewname='example_list', args=[self.project.item.id]) @@ -41,6 +41,14 @@ class TestExampleListAPI(CRUDMixin): def test_denies_unauthenticated_user_to_create_doc(self): self.assert_create(expected=status.HTTP_403_FORBIDDEN) + def test_is_confirmed(self): + make_example_state(self.example, self.project.users[0]) + response = self.assert_fetch(self.project.users[0], status.HTTP_200_OK) + self.assertTrue(response.data['results'][0]['is_confirmed']) + + def test_is_not_confirmed(self): + response = self.assert_fetch(self.project.users[0], status.HTTP_200_OK) + self.assertFalse(response.data['results'][0]['is_confirmed']) class TestExampleListFilter(CRUDMixin): diff --git a/backend/api/tests/test_serializers.py b/backend/api/tests/test_serializers.py deleted file mode 100644 index 5219f5de..00000000 --- a/backend/api/tests/test_serializers.py +++ /dev/null @@ -1,26 +0,0 @@ -from rest_framework.test import APITestCase - -from ..serializers import ExampleSerializer -from .api.utils import make_doc, make_example_state, prepare_project - - -class TestExampleStateSerializer(APITestCase): - - def setUp(self): - self.project = prepare_project(task='DocumentClassification') - self.example = make_doc(self.project.item) - - def test_in_is_confirmed(self): - serializer = ExampleSerializer(instance=self.example) - self.assertIn('is_confirmed', serializer.data) - - def test_is_not_confirmed(self): - serializer = ExampleSerializer(instance=self.example) - is_confirmed = serializer.data['is_confirmed'] - self.assertFalse(is_confirmed) - - def test_is_confirmed(self): - make_example_state(self.example, self.project.users[0]) - serializer = ExampleSerializer(instance=self.example) - is_confirmed = serializer.data['is_confirmed'] - self.assertTrue(is_confirmed)