You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
951 B

  1. from rest_framework.test import APITestCase
  2. from ..serializers import ExampleSerializer
  3. from .api.utils import make_doc, make_example_state, prepare_project
  4. class TestExampleStateSerializer(APITestCase):
  5. def setUp(self):
  6. self.project = prepare_project(task='DocumentClassification')
  7. self.example = make_doc(self.project.item)
  8. def test_in_is_confirmed(self):
  9. serializer = ExampleSerializer(instance=self.example)
  10. self.assertIn('is_confirmed', serializer.data)
  11. def test_is_not_confirmed(self):
  12. serializer = ExampleSerializer(instance=self.example)
  13. is_confirmed = serializer.data['is_confirmed']
  14. self.assertFalse(is_confirmed)
  15. def test_is_confirmed(self):
  16. make_example_state(self.example, self.project.users[0])
  17. serializer = ExampleSerializer(instance=self.example)
  18. is_confirmed = serializer.data['is_confirmed']
  19. self.assertTrue(is_confirmed)