public void CanAddUser() { OverlordIdentity.InitializeAdminUserIdentity(TestData.user_01_id, TestData.user_01_token, new string[0]); OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddUser); AzureStorage storage = new AzureStorage(); IStorageUser user = storage.AddUser("xUnit_CanAddUserTest_Name", "xUnit_CanAddUserTest_Token", null); Assert.NotNull(user.Id); Assert.Equal("xUnit_CanAddUserTest_Name", user.UserName); Assert.Equal("xUnit_CanAddUserTest_Token", user.Token); }
public void CanAuthorizeDeleteUser() { OverlordIdentity.InitializeUserIdentity(TestData.user_01_id.UrnToId(), "admin", new string[0]); AzureStorage storage = new AzureStorage(); OverlordIdentity.AddClaim(Resource.Storage, StorageAction.FindUser); IStorageUser user = storage.FindUser("d155074f-4e85-4cb5-a597-8bfecb0dfc04".ToGuid(), "admin"); Assert.Throws(typeof(System.Security.SecurityException), () => storage.DeleteUser(user)); OverlordIdentity.InitializeAdminUserIdentity(TestData.user_01_id.UrnToId(), "admin", new string[0]); Assert.Throws(typeof(System.Security.SecurityException), () => storage.DeleteUser(user)); }
private void InitialiseTestData() { AzureStorage storage = new AzureStorage(); OverlordIdentity.InitializeAdminUserIdentity(TestData.user_01_id, TestData.user_01_token, new string[0]); OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddUser); IStorageUser user_01 = storage.AddUser(TestData.user_01_name, TestData.user_01_token, null, TestData.user_01_id); OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddUser); IStorageUser user_02 = storage.AddUser(TestData.user_02_name, TestData.user_02_token, null, TestData.user_02_id); OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddUser); IStorageUser user_03 = storage.AddUser(TestData.user_03_name, TestData.user_03_token, null, TestData.user_03_id); }