def test_returns_folder_metadata_not_children(self):
        folder = GithubFolder(
            name='Folder',
            target=self.project,
            path='/Folder/'
        )
        folder.save()
        self._prepare_mock_wb_response(provider='github', files=[{'name': 'Folder'}], path='/Folder/')
        self.add_github()
        url = '/{}nodes/{}/files/github/Folder/'.format(API_BASE, self.project._id)
        res = self.app.get(url, params={'info': ''}, auth=self.user.auth)

        assert_equal(res.status_code, 200)
        assert_equal(res.json['data'][0]['attributes']['kind'], 'folder')
        assert_equal(res.json['data'][0]['attributes']['name'], 'Folder')
        assert_equal(res.json['data'][0]['attributes']['provider'], 'github')
    def test_returns_folder_metadata_not_children(self):
        folder = GithubFolder(
            name='Folder',
            target=self.project,
            path='/Folder/'
        )
        folder.save()
        self._prepare_mock_wb_response(provider='github', files=[{'name': 'Folder'}], path='/Folder/')
        self.add_github()
        url = '/{}nodes/{}/files/github/Folder/'.format(API_BASE, self.project._id)
        res = self.app.get(url, params={'info': ''}, auth=self.user.auth)

        assert_equal(res.status_code, 200)
        assert_equal(res.json['data'][0]['attributes']['kind'], 'folder')
        assert_equal(res.json['data'][0]['attributes']['name'], 'Folder')
        assert_equal(res.json['data'][0]['attributes']['provider'], 'github')
 def test_delete_action_for_folder_deletes_subfolders_and_creates_trashed_file_nodes(self):
     file_node = self.get_test_file()
     subfolder = GithubFolder(
         name='folder',
         node=self.project,
         path='/test/folder/',
         materialized_path='/test/folder/',
     )
     subfolder.save()
     payload = {
         'provider': file_node.provider,
         'metadata': {
             'path': '/test/',
             'materialized': '/test/'
         }
     }
     views.addon_delete_file_node(self=None, node=self.project, user=self.user, event_type='file_removed', payload=payload)
     assert_false(GithubFileNode.load(subfolder._id))
     assert_true(TrashedFileNode.load(file_node._id))
Exemple #4
0
 def test_delete_action_for_folder_deletes_subfolders_and_creates_trashed_file_nodes(self):
     file_node = self.get_test_file()
     subfolder = GithubFolder(
         name='folder',
         node=self.project,
         path='/test/folder/',
         materialized_path='/test/folder/',
     )
     subfolder.save()
     payload = {
         'provider': file_node.provider,
         'metadata': {
             'path': '/test/',
             'materialized': '/test/'
         }
     }
     views.addon_delete_file_node(self=None, node=self.project, user=self.user, event_type='file_removed', payload=payload)
     assert_false(GithubFileNode.load(subfolder._id))
     assert_true(TrashedFileNode.load(file_node._id))