示例#1
0
 def test_dropbox_folder_list_folders_only(self):
     with patch_client('addons.dropbox.models.Dropbox'):
         url = self.project.api_url_for('dropbox_folder_list')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.files_list_folder('').entries
         expected = [each for each in contents if isinstance(each, MockFolderMetadata)]
         assert len(res.json) == len(expected)
示例#2
0
 def test_dropbox_folder_list_folders_only(self):
     with patch_client('addons.dropbox.models.DropboxClient'):
         url = self.project.api_url_for('dropbox_folder_list')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.metadata('', list=True)['contents']
         expected = [each for each in contents if each['is_dir']]
         assert len(res.json) == len(expected)
示例#3
0
 def test_dropbox_folder_list_include_root(self, mock_metadata):
     with patch_client('addons.dropbox.models.Dropbox'):
         url = self.project.api_url_for('dropbox_folder_list')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.files_list_folder('').entries
         assert len(res.json) == 1
         assert len(res.json) != len(contents)
         assert res.json[0]['path'] == '/'
示例#4
0
 def test_dropbox_folder_list_include_root(self, mock_metadata):
     with patch_client('addons.dropbox.models.Dropbox'):
         url = self.project.api_url_for('dropbox_folder_list')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.files_list_folder('').entries
         assert len(res.json) == 1
         assert len(res.json) != len(contents)
         assert res.json[0]['path'] == '/'
示例#5
0
 def test_dropbox_folder_list_folders_only(self):
     with patch_client('addons.dropbox.models.Dropbox'):
         url = self.project.api_url_for('dropbox_folder_list')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.files_list_folder('').entries
         expected = [
             each for each in contents
             if isinstance(each, MockFolderMetadata)
         ]
         assert len(res.json) == len(expected)
示例#6
0
    def test_dropbox_folder_list(self):
        with patch_client('addons.dropbox.models.Dropbox'):
            url = self.project.api_url_for(
                'dropbox_folder_list',
                folder_id='/',
            )
            res = self.app.get(url, auth=self.user.auth)
            contents = [x for x in mock_client.files_list_folder('').entries if isinstance(x, MockFolderMetadata)]
            first = res.json[0]

            assert len(res.json) == len(contents)
            assert 'kind' in first
            assert first['path'] == contents[0].path_display
示例#7
0
    def test_dropbox_folder_list(self):
        with patch_client('addons.dropbox.models.Dropbox'):
            url = self.project.api_url_for(
                'dropbox_folder_list',
                folder_id='/',
            )
            res = self.app.get(url, auth=self.user.auth)
            contents = [
                x for x in mock_client.files_list_folder('').entries
                if isinstance(x, MockFolderMetadata)
            ]
            first = res.json[0]

            assert len(res.json) == len(contents)
            assert 'kind' in first
            assert first['path'] == contents[0].path_display
示例#8
0
    def test_dropbox_folder_list(self):
        with patch_client('addons.dropbox.models.DropboxClient'):
            url = self.project.api_url_for(
                'dropbox_folder_list',
                folder_id='/',
            )
            res = self.app.get(url, auth=self.user.auth)
            contents = [
                x for x in mock_client.metadata('', list=True)['contents']
                if x['is_dir']
            ]
            first = res.json[0]

            assert len(res.json) == len(contents)
            assert 'kind' in first
            assert first['path'] == contents[0]['path']