def test_returns_auditors_as_default_assessors_when_no_template( self, person_class, get_current_user_id ): """The function should return all Audit's assessors if no template given. """ person_class.query.get.return_value = MagicMock(name="Person XY") get_current_user_id.return_value = 42 people = assessment.get_value( "assessors", self.audit, self.related_object, template=None) self.assertEqual(people, [self.person_1, self.person_3])
def test_returns_auditors_as_default_verifiers_when_set_in_template( self, person_class, get_current_user_id): """The function should return all Audit's auditors if the template says so. """ person_class.query.get.return_value = MagicMock(name="Person XY") get_current_user_id.return_value = 42 assessment_template = MagicMock(default_people={ "assessors": "Object Owners", "verifiers": "Auditors" }) people = assessment.get_value("verifiers", [], self.audit, self.related_object, template=assessment_template) self.assertEqual(people, [self.person_1, self.person_3])
def test_returns_auditors_as_default_verifiers_when_set_in_template( self, person_class, get_current_user_id ): """The function should return all Audit's auditors if the template says so. """ person_class.query.get.return_value = MagicMock(name="Person XY") get_current_user_id.return_value = 42 assessment_template = MagicMock( default_people={"assessors": "Object Owners", "verifiers": "Auditors"} ) people = assessment.get_value( "verifiers", self.audit, self.related_object, template=assessment_template ) self.assertEqual(people, [self.person_1, self.person_3])