示例#1
0
 def test_delete_action_creates_trashed_file_node(self):
     file_node = self.get_test_file()
     payload = {
         'provider': file_node.provider,
         'metadata': {
             'path': '/test/Test',
             'materialized': '/test/Test'
         }
     }
     views.addon_delete_file_node(self=None, node=self.project, user=self.user, event_type='file_removed', payload=payload)
     assert_false(GithubFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
示例#2
0
 def test_delete_action_creates_trashed_file_node(self):
     file_node = self.get_test_file()
     payload = {
         'provider': file_node.provider,
         'metadata': {
             'path': '/test/Test',
             'materialized': '/test/Test'
         }
     }
     views.addon_delete_file_node(self=None, node=self.project, user=self.user, event_type='file_removed', payload=payload)
     assert_false(GithubFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
示例#3
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))
示例#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))