def test_invalid_user_non_shared_scope(self): user = SystemUser(name="name", scope="none") error = self.assertRaises(errors.SystemUsernamesValidationError, user.validate) self.assertThat(error._name, Equals("name")) self.assertThat(error._message, Equals("scope 'none' is invalid"))
def test_invalid_user_empty_scope(self): user = SystemUser(name="name", scope=None) error = self.assertRaises(errors.SystemUsernamesValidationError, user.validate) self.assertThat(error._name, Equals("name")) self.assertThat(error._message, Equals("scope None is invalid"))
def test_invalid_user_empty_scope(self): user = SystemUser(name="name", scope=None) error = self.assertRaises(errors.SystemUsernamesValidationError, user.validate) self.assertThat( error.get_brief(), Equals( "Invalid system-usernames for 'name': scope None is invalid"), )
def test_valid_user(self): user = SystemUser(name="name", scope=SystemUserScope.SHARED) user.validate() user_dict = {"scope": "shared"} user = SystemUser.from_dict(user_name="name", user_dict=user_dict)