コード例 #1
0
ファイル: test_journalist.py プロジェクト: tmc/securedrop
    def test_delete_source_deletes_submissions(self):
        """Verify that when a source is deleted, the submissions that
        correspond to them are also deleted."""

        self._delete_collection_setup()
        journalist.delete_collection(self.source.filesystem_id)

        # Source should be gone
        results = db_session.query(Source).filter(
            Source.id == self.source.id).all()
コード例 #2
0
 def test_delete_collection_updates_db(self):
     """Verify that when a source is deleted, their Source identity
     record, as well as Reply & Submission records associated with
     that record are purged from the database."""
     self._delete_collection_setup()
     journalist.delete_collection(self.source.filesystem_id)
     results = Source.query.filter(Source.id == self.source.id).all()
     self.assertEqual(results, [])
     results = db_session.query(Submission.source_id == self.source.id).all()
     self.assertEqual(results, [])
     results = db_session.query(Reply.source_id == self.source.id).all()
     self.assertEqual(results, [])
コード例 #3
0
ファイル: test_journalist.py プロジェクト: tmc/securedrop
    def test_delete_source_deletes_source_key(self):
        """Verify that when a source is deleted, the PGP key that corresponds
        to them is also deleted."""
        self._delete_collection_setup()

        # Source key exists
        source_key = crypto_util.getkey(self.source.filesystem_id)
        self.assertNotEqual(source_key, None)

        journalist.delete_collection(self.source.filesystem_id)

        # Source key no longer exists
        source_key = crypto_util.getkey(self.source.filesystem_id)
        self.assertEqual(source_key, None)
コード例 #4
0
    def test_delete_source_deletes_docs_on_disk(self):
        """Verify that when a source is deleted, the encrypted documents that
        exist on disk is also deleted."""
        self._delete_collection_setup()

        # Encrypted documents exists
        dir_source_docs = os.path.join(config.STORE_DIR, self.source.filesystem_id)
        self.assertTrue(os.path.exists(dir_source_docs))

        job = journalist.delete_collection(self.source.filesystem_id)

        # Wait up to 5s to wait for Redis worker `srm` operation to complete
        utils.async.wait_for_redis_worker(job)

        # Encrypted documents no longer exist
        self.assertFalse(os.path.exists(dir_source_docs))