def test_superuser_can_update_reports_to(mock_task, gql_client, default_user, default_superuser, ga_department): new_person = factories.UserFactory() executed = gql_client.execute( """ mutation($user: UUID!, $reportsTo: NullableUUID) { updateUser(user: $user, data: {reportsTo: $reportsTo}) { ok errors user { id } } }""", variables={ "user": str(default_user.id), "reportsTo": str(new_person.id) }, user=default_superuser, ) assert not executed.get("errors") resp = executed["data"]["updateUser"] assert not resp["errors"] assert resp["ok"] is True assert resp["user"] == {"id": str(default_user.id)} mock_task.assert_called_once_with(user_id=default_user.id, updates={"reports_to": new_person.id}, version=1) user = User.objects.get(id=default_user.id) assert user.profile.reports_to_id == new_person.id
def default_user(db, design_department): user = factories.UserFactory( id=UUID("449c76aa-ad6a-46a8-b32b-91d965e3f462"), name="Reel Big Phish", email="*****@*****.**", ) user.set_password("phish.reel.big") user.save() factories.ProfileFactory.create( user=user, title="Dummy", date_started=date(2010, 4, 26), date_of_birth=date(1990, 8, 12), department=design_department, office=None, reports_to=None, referred_by=None, employee_type="FULL_TIME", has_onboarded=True, ) return user
def default_superuser(db, ga_department): user = factories.UserFactory( id=UUID("559c76aa-ad6a-46a8-b32b-91d965e3f462"), name="Captain Planet", email="*****@*****.**", is_superuser=True, ) user.set_password("planet.captain") user.save() factories.ProfileFactory.create( user=user, title="Super Dummy", date_started=date(2010, 5, 26), date_of_birth=date(1990, 2, 13), department=ga_department, office=None, employee_type="FULL_TIME", reports_to=None, referred_by=None, has_onboarded=True, ) return user