コード例 #1
0
ファイル: test_models.py プロジェクト: canassa/localshop
    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)
コード例 #2
0
ファイル: test_models.py プロジェクト: thedrow/localshop
    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))
コード例 #3
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))
コード例 #4
0
ファイル: test_models.py プロジェクト: canassa/localshop
    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)
コード例 #5
0
ファイル: test_models.py プロジェクト: thedrow/localshop
    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))
コード例 #6
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))