Exemple #1
0
        public async Task Deauthorize_WithNullFolderName_ThrowsException(FolderSyncanoClient client)
        {
            try
            {
                //when
                await client.Deauthorize(TestData.UserApiClientId, Permissions.DeleteData, TestData.ProjectId,
                                         null, TestData.CollectionId);

                throw new Exception("Deauthorize should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <ArgumentNullException>();
            }
        }
Exemple #2
0
        public async Task Deauthorize_WithInvalidUserApiKey_ThrowsException(FolderSyncanoClient client)
        {
            try
            {
                //when
                await client.Deauthorize("abcde", Permissions.DeleteData, TestData.ProjectId,
                                         TestData.FolderName, TestData.CollectionId);

                throw new Exception("Deauthorize should throw an exception");
            }
            catch (Exception e)
            {
                //then
                e.ShouldBeType <SyncanoException>();
            }
        }
Exemple #3
0
        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);
        }