public Deauthorize ( string apiClientId, Permissions permission, string projectId, string collectionId = null, string collectionKey = null ) : Task |
||
apiClientId | string | User API client id. |
permission | Permissions | User API client's permission to add. |
projectId | string | Defines project containing specified container. |
collectionId | string | Collection id defining collection that permission will be added to. |
collectionKey | string | Collection key defining collection that permission will be added to. |
return | Task |
public async Task Deauthorize_WithInvalidUserApiClientId_ThrowsException(CollectionSyncanoClient client) { try { //when await client.Deauthorize("abcde", Permissions.DeleteOwnData, TestData.ProjectId, TestData.CollectionId); throw new Exception("Deauthorize should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<SyncanoException>(); } }
public async Task Authorize_ByCollectionKey(CollectionSyncanoClient client) { //given string collectionName = "NewCollection test " + DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString(); string collectionKey = "qwert"; var collection = await client.New(TestData.ProjectId, collectionName, collectionKey); await client.Activate(TestData.ProjectId, collection.Id, true); //when var result = await client.Authorize(TestData.UserApiClientId, Permissions.UpdateOwnData, TestData.ProjectId, collectionKey: collectionKey); //then result.ShouldBeTrue(); //cleanup await client.Deauthorize(TestData.UserApiClientId, Permissions.UpdateOwnData, TestData.ProjectId, collection.Id); await client.Delete(TestData.ProjectId, collection.Id); }
public async Task Deauthorize_WithNullProjectId_ThrowsException(CollectionSyncanoClient client) { try { //when await client.Deauthorize(TestData.UserApiClientId, Permissions.DeleteOwnData, null, TestData.CollectionId); throw new Exception("Deauthorize should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<ArgumentNullException>(); } }