Exemple #1
0
    def test_delete_file(self):
        release_file = factories.ReleaseFileFactory()

        dummy_fh = six.BytesIO(six.b("release-file-contents"))
        release_file.save_filecontent('dummy.txt', dummy_fh)

        assert os.path.exists(release_file.distribution.path)

        utils.delete_files(models.ReleaseFile, instance=release_file)
        assert not os.path.exists(release_file.distribution.path)
Exemple #2
0
    def test_delete_file(self):
        release_file = factories.ReleaseFileFactory()

        dummy_fh = StringIO("release-file-contents")
        release_file.save_filecontent('dummy.txt', dummy_fh)

        self.assertTrue(os.path.exists(release_file.distribution.path))

        utils.delete_files(models.ReleaseFile, instance=release_file)
        self.assertFalse(os.path.exists(release_file.distribution.path))
    def test_delete_file(self):
        release_file = factories.ReleaseFileFactory()

        dummy_fh = StringIO("release-file-contents")
        release_file.save_filecontent('dummy.txt', dummy_fh)

        self.assertTrue(os.path.exists(release_file.distribution.path))

        utils.delete_files(models.ReleaseFile, instance=release_file)
        self.assertFalse(os.path.exists(release_file.distribution.path))
Exemple #4
0
    def test_delete_file_twice_referenced(self):
        dummy_fh = six.BytesIO(six.b("release-file-contents"))

        release_file = factories.ReleaseFileFactory()
        release_file.save_filecontent('dummy.txt', dummy_fh)

        release_file = factories.ReleaseFileFactory(
            release=release_file.release, filetype='bdist_egg')
        release_file.save_filecontent('dummy.txt', dummy_fh)

        assert os.path.exists(release_file.distribution.path)

        utils.delete_files(models.ReleaseFile, instance=release_file)

        # File should still exist
        assert os.path.exists(release_file.distribution.path)
Exemple #5
0
    def test_delete_file_twice_referenced(self):
        release_file = factories.ReleaseFileFactory()

        dummy_fh = StringIO("release-file-contents")
        release_file.save_filecontent('dummy.txt', dummy_fh)

        release_file = factories.ReleaseFileFactory(
            release=release_file.release, filetype='bdist_egg')
        release_file.save_filecontent('dummy.txt', dummy_fh)

        self.assertTrue(os.path.exists(release_file.distribution.path))

        utils.delete_files(models.ReleaseFile, instance=release_file)

        # File should still exist
        self.assertTrue(os.path.exists(release_file.distribution.path))
    def test_delete_file_twice_referenced(self):
        release_file = factories.ReleaseFileFactory()

        dummy_fh = StringIO("release-file-contents")
        release_file.save_filecontent('dummy.txt', dummy_fh)

        release_file = factories.ReleaseFileFactory(
            release=release_file.release, filetype='bdist_egg')
        release_file.save_filecontent('dummy.txt', dummy_fh)

        self.assertTrue(os.path.exists(release_file.distribution.path))

        utils.delete_files(models.ReleaseFile, instance=release_file)

        # File should still exist
        self.assertTrue(os.path.exists(release_file.distribution.path))