Ejemplo n.º 1
0
        public void Put_at_directory_path_throws()
        {
            var data = AwsTestHelpers.CreateRandomDocument();

            try {
                _client.PutFile("foo/bar/", AwsTestHelpers.CreateFileHandle(data, null));
                Assert.Fail("didn't throw");
            } catch (InvalidOperationException) { }
        }
Ejemplo n.º 2
0
        public void Can_put_file()
        {
            var data = AwsTestHelpers.CreateRandomDocument();

            MockPlug.Setup(AwsTestHelpers.AWS.S3Uri)
            .Verb("PUT")
            .At(_config.RootedPath("foo", "bar"))
            .WithBody(data)
            .Returns(DreamMessage.Ok())
            .ExpectAtLeastOneCall();
            _client.PutFile("foo/bar", AwsTestHelpers.CreateFileHandle(data, null));
            MockPlug.VerifyAll();
        }
Ejemplo n.º 3
0
        public void Send_cache_control_header_when_writing_object()
        {
            var data = AwsTestHelpers.CreateRandomDocument();

            MockPlug.Setup(AwsTestHelpers.AWS.S3Uri)
            .Verb("PUT")
            .At(_config.RootedPath("foo", "bar"))
            .WithHeader("Cache-Control", "max-age=29030400, public")
            .WithBody(data)
            .Returns(DreamMessage.Ok())
            .ExpectAtLeastOneCall();
            var handle = AwsTestHelpers.CreateFileHandle(data, null);

            handle.CacheControl = "max-age=29030400, public";
            _client.PutFile("foo/bar", handle);
        }
Ejemplo n.º 4
0
        public void Can_put_file_with_expiration()
        {
            var data = AwsTestHelpers.CreateRandomDocument();

            MockPlug.Setup(AwsTestHelpers.AWS.S3Uri)
            .Verb("PUT")
            .At(_config.RootedPath("foo", "bar"))
            .WithHeader("x-amz-meta-ttl", 1.ToInvariantString())
            .WithBody(data)
            .Returns(DreamMessage.Ok())
            .ExpectAtLeastOneCall();
            MockPlug.Setup(AwsTestHelpers.AWS.S3Uri)
            .Verb("DELETE")
            .At(_config.RootedPath("foo", "bar"))
            .Returns(new DreamMessage(DreamStatus.NoContent, null))
            .ExpectAtLeastOneCall();
            _client.PutFile("foo/bar", AwsTestHelpers.CreateFileHandle(data, 1.Seconds()));
            MockPlug.VerifyAll(10.Seconds());
        }