public Authorize ( string apiClientId, Permissions permission, string projectId, string folderName, string collectionId = null, string collectionKey = null ) : Task |
||
apiClientId | string | User API client id. |
permission | Permissions | User API client's permission to add. |
projectId | string | Project containing specified container. |
folderName | string | Folder name defining folder that permission will be added to. |
collectionId | string | Collection containing specified container. |
collectionKey | string | Collection containing specified container. |
return | Task |
public async Task Authorize_WithInvalidApiClientId_ThrowsException(FolderSyncanoClient client) { try { //when await client.Authorize("abcde", Permissions.DeleteData, TestData.ProjectId, TestData.FolderName, TestData.CollectionId); throw new Exception("Authorize should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<SyncanoException>(); } }
public async Task Deauthorize_ByCollectionKey(FolderSyncanoClient client) { //given string folderName = "Authorize Test " + DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString(); await client.New(TestData.ProjectId, folderName, collectionKey: TestData.CollectionKey); await client.Authorize(TestData.UserApiClientId, Permissions.CreateData, TestData.ProjectId, TestData.FolderName, collectionKey: TestData.CollectionKey); //when var result = await client.Deauthorize(TestData.UserApiClientId, Permissions.CreateData, TestData.ProjectId, TestData.FolderName, collectionKey: TestData.CollectionKey); //then result.ShouldBeTrue(); //cleanup await client.Delete(TestData.ProjectId, folderName, collectionKey: TestData.CollectionKey); }
public async Task Authorize_WithNullFolderName_ThrowsException(FolderSyncanoClient client) { try { //when await client.Authorize(TestData.UserApiClientId, Permissions.DeleteData, TestData.ProjectId, null, TestData.CollectionId); throw new Exception("Authorize should throw an exception"); } catch (Exception e) { //then e.ShouldBeType<ArgumentNullException>(); } }