示例#1
0
        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>();
            }
        }
示例#2
0
        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>();
            }
        }
示例#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);
        }