def test_profile_get_successful(self): """Test person_profile GET method successfully achieves correct data""" with factories.single_commit(): user = factories.PersonFactory() self._create_users_names_rbac([user]) self.api.set_user(person=user) response = self.api.client.get("/api/people/{}/profile".format(user.id)) self.assert_profile_get_successful(response, default_date())
def test_profile_get_no_profile(self): """Test person_profile GET method achieves data with missing profile""" with factories.single_commit(): user = factories.PersonFactory() self._create_users_names_rbac([user]) self.api.set_user(person=user) profiles_table = PersonProfile.__table__ db_request = profiles_table.delete().where( profiles_table.c.person_id == user.id) db.engine.execute(db_request) with freeze_time("2018-05-28 23:30:10"): response = self.api.client.get("/api/people/{}/profile".format(user.id)) self.assert_profile_get_successful(response, default_date())