Example #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(StoredFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
Example #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(StoredFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
Example #3
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(StoredFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
Example #4
0
 def test_delete_action_for_folder_deletes_subfolders_and_creates_trashed_file_nodes(self):
     file_node = self.get_test_file()
     subfolder = TestFolder(
         name="folder", node=self.project, path="/test/folder/", materialized_path="/test/folder/", versions=[]
     )
     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(StoredFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
     assert_false(StoredFileNode.load(subfolder._id))
Example #5
0
 def test_delete_action_for_folder_deletes_subfolders_and_creates_trashed_file_nodes(self):
     file_node = self.get_test_file()
     subfolder = TestFolder(
         name='folder',
         node=self.project,
         path='/test/folder/',
         materialized_path='/test/folder/',
         versions=[]
     )
     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(StoredFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
     assert_false(StoredFileNode.load(subfolder._id))
Example #6
0
 def test_delete_action_for_folder_deletes_subfolders_and_creates_trashed_file_nodes(self):
     file_node = self.get_test_file()
     subfolder = TestFolder(
         name='folder',
         node=self.project,
         path='/test/folder/',
         materialized_path='/test/folder/',
         versions=[]
     )
     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(StoredFileNode.load(file_node._id))
     assert_true(TrashedFileNode.load(file_node._id))
     assert_false(StoredFileNode.load(subfolder._id))