def test_upsert_instructor_when_existing_instructors( self, group_info, existing_instructors): new_instructor = factories.HUser(username="******")._asdict() group_info.upsert_instructor(new_instructor) assert group_info.instructors == existing_instructors + [ new_instructor ]
def test_upsert_instructor_when_existing_matching_instructor( self, group_info, existing_instructors): updated_instructor = factories.HUser( username=group_info.instructors[1]["username"], display_name="updated", )._asdict() group_info.upsert_instructor(updated_instructor) assert group_info.instructors == [ existing_instructors[0], updated_instructor, existing_instructors[2], ]
def h_user(): return factories.HUser()
def test_upsert_instructor_when_no_existing_instructors(self, group_info): instructor = factories.HUser()._asdict() group_info.upsert_instructor(instructor) assert group_info.instructors == [instructor]
def h_api(pyramid_config): h_api = mock.create_autospec(HAPI, spec_set=True, instance=True) h_api.get_user.return_value = factories.HUser() pyramid_config.register_service(h_api, name="h_api") return h_api
def test_userid(self): h_user = factories.HUser(username="******") assert h_user.userid("test_authority") == "acct:test_username@test_authority"