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)
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)
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'] == '/'
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)
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
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
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']