def setUp(self) -> None: super(AuthServicesTests, self).setUp() self.signup(self.NEW_USER_EMAIL, self.NEW_USER_USERNAME) self.full_user_id = self.get_user_id_from_email( self.NEW_USER_EMAIL) # type: ignore[no-untyped-call] self.auth_id = self.get_auth_id_from_email( self.NEW_USER_EMAIL) # type: ignore[no-untyped-call] self.modifiable_full_user_data = user_domain.ModifiableUserData( 'full_user_1', '12345', [constants.DEFAULT_LANGUAGE_CODE], None, None, None, user_id=self.full_user_id) self.modifiable_profile_user_data = [ user_domain.ModifiableUserData('profile_user_1', '12345', [constants.DEFAULT_LANGUAGE_CODE], None, None, None), user_domain.ModifiableUserData('profile_user_2', '12345', [constants.DEFAULT_LANGUAGE_CODE], None, None, None), ] user_services.update_multiple_users_data( [self.modifiable_full_user_data]) profile_users = user_services.create_new_profiles( self.auth_id, self.NEW_USER_EMAIL, self.modifiable_profile_user_data) self.profile_user_1_id = profile_users[0].user_id self.profile_user_2_id = profile_users[1].user_id
def test_validate_empty_display_alias_for_profiles_raises_error(self): self.modifiable_user_data.user_id = self.owner_id self.modifiable_user_data.pin = '12345' self.modifiable_user_data.display_alias = 'temp_name' user_services.update_multiple_users_data([self.modifiable_user_data]) auth_id = self.get_auth_id_from_email(self.OWNER_EMAIL) profile_pin = '123' error_msg = 'Expected display_alias to be a string, received' with self.assertRaisesRegexp(utils.ValidationError, error_msg): self.modifiable_new_user_data.display_alias = '' self.modifiable_new_user_data.pin = profile_pin user_services.create_new_profiles(auth_id, self.OWNER_EMAIL, [self.modifiable_new_user_data])