Ejemplo n.º 1
0
        public void test_get_container()
        {
            _headers.Add("request-type", "container");
            ContainerResponse res = _client.GetContainer("", "", "", _headers, new Dictionary <string, string>(), false);

            Assert.True(res.Headers.ContainsKey("x-container-object-count"));
            Assert.True(res.Headers["x-container-object-count"] == "1");
            Assert.True(res.Headers.ContainsKey("x-container-bytes-used"));
            Assert.True(res.Headers["x-container-bytes-used"] == "1");
            Assert.True(res.Headers.ContainsKey("x-container-meta-foo"));
            Assert.True(res.Headers["x-container-meta-foo"] == "foo");
            Assert.True(res.Reason == "foo");
            Assert.True(res.Status == 200);
            Assert.True(res.Objects[0]["content_type"] == "foo/foo");
            Assert.True(res.Objects[0]["hash"] == "foo");
            Assert.True(res.Objects[0]["last_modified"] == "foo");
            Assert.True(res.Objects[0]["bytes"] == "1");
            Assert.True(res.Objects[0]["name"] == "foo");
        }
Ejemplo n.º 2
0
 public void teardown()
 {
     teardown_query["prefix"] = prefix;
     try
     {
         foreach (var container_info in client.GetAccount(storage_url, auth_token, new Dictionary <string, string>(), teardown_query, false).Containers)
         {
             foreach (var object_info in client.GetContainer(storage_url, auth_token, container_info["name"], new Dictionary <string, string>(), new Dictionary <string, string>(), false).Objects)
             {
                 client.DeleteObject(storage_url, auth_token, container_info["name"],
                                     container_info.ContainsKey("name") ? object_info["name"] : object_info["subdir"],
                                     new Dictionary <string, string>(), new Dictionary <string, string>());
             }
             client.DeleteContainer(storage_url, auth_token, container_info["name"], new Dictionary <string, string>(), new Dictionary <string, string>());
         }
     }
     catch (ClientException)
     {
     }
 }