def test_fields_role(self): data = self.sample_data()[0] project = models.Project(data=data) role_data = [{'id': 100}] with self.patch_get(resource='roles', data=role_data, many=True) as get: role = project.role self.assertEqual(100, role.id) self.assertEqual(1, get.call_count)
def test_fields_person(self): data = self.sample_data()[0] project = models.Project(data=data) person_data = [{'id': 10}] with self.patch_get(resource='people', data=person_data, many=True) as get: person = project.person self.assertEqual(10, person.id) self.assertEqual(1, get.call_count)
def test_fields_circle(self): data = self.sample_data()[0] project = models.Project(data=data) circle_data = [{'id': 1}] with self.patch_get(resource='circles', data=circle_data, many=True) as get: circle = project.circle self.assertEqual(1, circle.id) self.assertEqual(1, get.call_count)
def test_fields_empty(self): data = self.sample_data()[1] project = models.Project(data=data) self.assertEqual(666, project.id) self.assertEqual("I want you to do this for me", project.description) self.assertEqual("Current", project.status) self.assertEqual(None, project.waiting_on_what) self.assertEqual(None, project.waiting_on_who) self.assertEqual(False, project.private_to_circle) expected_date = datetime(2016, 11, 6, 18, 51, 12, tzinfo=timezone.utc) self.assertEqual(expected_date, project.created_at) self.assertEqual(None, project.archived_at)
def test_fields(self): data = self.sample_data()[0] project = models.Project(data=data) self.assertEqual(42, project.id) self.assertEqual("Please, fill up the experts in Hollywood", project.description) self.assertEqual("Waiting", project.status) self.assertEqual("Extend its arms", project.waiting_on_what) self.assertEqual("T-Rex", project.waiting_on_who) self.assertEqual(True, project.private_to_circle) expected_date = datetime(2016, 11, 6, 18, 51, 12, tzinfo=timezone.utc) self.assertEqual(expected_date, project.created_at) expected_date = datetime(2019, 11, 6, 18, 51, 12, tzinfo=timezone.utc) self.assertEqual(expected_date, project.archived_at)