Beispiel #1
0
    def test_upload_assets(self, mock):
        """should only add one asset to the upload dictionary"""
        deploy = Deploy(self.site, self.config)
        deploy.site.assets["foo"] = "foo"
        deploy.site.assets["_bar"] = "bar"
        deploy.upload_assets()

        mock.assert_called_once_with("foo", "foo")
Beispiel #2
0
    def test_redirects(self):
        """should always get the correct redirects"""
        deploy = Deploy(self.site, self.config)
        self.assertEqual(deploy.redirects, "asdf")

        self.config.redirects = "1234"
        self.config.options["s3cf"]["redirects"] = None
        deploy = Deploy(self.site, self.config)
        self.assertEqual(deploy.redirects, "1234")
Beispiel #3
0
    def test_redirect_exists(self):
        """should return True if a redirect exists, False if not"""
        class BucketMock(object):
            @classmethod
            def get_key(cls, redirect):
                return redirect

        deploy = Deploy(self.site, self.config)
        deploy.bucket = BucketMock()
        self.assertTrue(deploy.redirect_exists(True))
        self.assertFalse(deploy.redirect_exists(False))
Beispiel #4
0
    def test_init_missing_bucket(self):
        """
        should raise an exception if there is a dot in the bucket name and not
        s3_host specified
        """
        self.config.options["s3cf"]["bucket"] = "foo.bar"

        self.assertRaises(
            S3HostMissingException,
            Deploy,
            self.site,
            self.config,
        )

        self.config.options["s3cf"]["s3_host"] = "foo"

        Deploy(self.site, self.config)