public void KrakenClient_OptimizeWaitAzureAddHeadersAndMeta_IsTrue()
        {
            var krakenClient = HelperFunctions.CreateWorkingClient();

            var dataStore = new DataStore(
                Settings.AzureAccount,
                Settings.AzureKey,
                Settings.AzureContainer);

            dataStore.AddMetadata("x-ms-meta-test1", "value1"); // prefix removed automatically, added by kraken later
            dataStore.AddMetadata("test2", "value2");
            dataStore.AddHeaders("Cache-Control", "public, max-age=2222");

            var response = krakenClient.OptimizeWait(
                new SeaMist.Model.Azure.OptimizeWaitRequest(
                    new Uri(TestData.ImageOne),
                    dataStore
                    )
            {
                ResizeImage = new ResizeImage {
                    Height = 100, Width = 100
                },
                WebP = true
            }
                );

            var result = response.Result;

            Assert.IsTrue(result.StatusCode == HttpStatusCode.OK);
            Assert.IsTrue(result.Success);
            Assert.IsTrue(!string.IsNullOrEmpty(result.Body.KrakedUrl));
            Assert.IsTrue(result.Body.KrakedUrl.Contains("blob.core.windows.net"));
        }
示例#2
0
        public void Client_OptimizeWaitAmazonAddHeadersAndMeta_IsTrue()
        {
            var client = HelperFunctions.CreateWorkingClient();

            var dataStore = new DataStore(
                Settings.AmazonKey,
                Settings.AmazonSecret,
                Settings.AmazonBucket,
                string.Empty
                );

            dataStore.AddMetadata("x-amz-meta-test1", "value11"); // Prefix will be removeda and added by kraken later
            dataStore.AddMetadata("test2", "value22");
            dataStore.AddHeaders("Cache-Control", "max-age=2222");

            var response = client.OptimizeWait(
                new OptimizeWaitRequest(
                    new Uri(TestData.ImageOne),
                    dataStore
                    )
            {
                ResizeImage = new ResizeImage {
                    Height = 100, Width = 100
                },
                WebP = true
            }
                );

            var result = response.Result;

            Assert.IsTrue(result.StatusCode == HttpStatusCode.OK);
            Assert.IsTrue(result.Success);
            Assert.IsTrue(!string.IsNullOrEmpty(result.Body.KrakedUrl));
            Assert.IsTrue(result.Body.KrakedUrl.Contains(".amazonaws.com"));
        }