示例#1
0
 def test_box_list_folders_folders_only(self):
     with patch_client('website.addons.box.views.BoxClient'):
         url = self.project.api_url_for('box_folder_list', foldersOnly=True)
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.get_folder('', list=True)['item_collection']['entries']
         expected = [each for each in contents if each['type']=='folder']
         assert_equal(len(res.json), len(expected))
示例#2
0
 def test_box_list_folders_folders_only(self):
     with patch_client("website.addons.box.views.BoxClient"):
         url = self.project.api_url_for("box_folder_list", foldersOnly=True)
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.get_folder("", list=True)["item_collection"]["entries"]
         expected = [each for each in contents if each["type"] == "folder"]
         assert_equal(len(res.json), len(expected))
示例#3
0
 def test_box_list_folders_if_folder_is_none_and_folders_only(self):
     with patch_client("website.addons.box.views.BoxClient"):
         self.node_settings.folder_name = None
         self.node_settings.save()
         url = api_url_for("box_folder_list", pid=self.project._primary_key, foldersOnly=True)
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.get_folder("", list=True)["item_collection"]["entries"]
         expected = [each for each in contents if each["type"] == "folder"]
         assert_equal(len(res.json), len(expected))
示例#4
0
 def test_box_list_folders_if_folder_is_none_and_folders_only(self):
     with patch_client('website.addons.box.views.BoxClient'):
         self.node_settings.folder_name = None
         self.node_settings.save()
         url = api_url_for('box_folder_list',
             pid=self.project._primary_key, foldersOnly=True)
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.get_folder('', list=True)['item_collection']['entries']
         expected = [each for each in contents if each['type']=='folder']
         assert_equal(len(res.json), len(expected))
示例#5
0
 def test_box_list_folders(self):
     with patch_client('website.addons.box.model.BoxClient'):
         url = self.project.api_url_for('box_folder_list', folder_id='foo')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.get_folder('', list=True)['item_collection']['entries']
         expected = [each for each in contents if each['type']=='folder']
         assert_equal(len(res.json), len(expected))
         first = res.json[0]
         assert_in('kind', first)
         assert_equal(first['name'], contents[0]['name'])
示例#6
0
 def test_box_list_folders(self):
     with patch_client('website.addons.box.views.config.get_node_client'):
         url = self.project.api_url_for('box_list_folders', folderId='foo')
         res = self.app.get(url, auth=self.user.auth)
         contents = mock_client.get_folder(
             '', list=True)['item_collection']['entries']
         expected = [each for each in contents if each['type'] == 'folder']
         assert_equal(len(res.json), len(expected))
         first = res.json[0]
         assert_in('kind', first)
         assert_equal(first['name'], contents[0]['name'])