示例#1
0
        public void test_get_auth()
        {
            _headers.Add("request-type", "auth");
            var res = _client.GetAuth("", "", "", _headers, new Dictionary <string, string>(), false);

            Assert.True(res.Headers.ContainsKey("x-auth-token"));
            Assert.True(res.Headers["x-auth-token"] == "foo");
            Assert.True(res.Headers.ContainsKey("x-storage-url"));
            Assert.True(res.Headers["x-storage-url"] == "https://foo.com");
            Assert.True(res.Reason == "foo");
            Assert.True(res.Status == 201);
            res = _client.GetAuth("", "", "", _headers, new Dictionary <string, string>(), true);
            Assert.True(res.Headers.ContainsKey("x-auth-token"));
            Assert.True(res.Headers["x-auth-token"] == "foo");
            Assert.True(res.Headers.ContainsKey("x-storage-url"));
            Assert.True(res.Headers["x-storage-url"] == "https://snet-foo.com/");
            Assert.True(res.Reason == "foo");
            Assert.True(res.Status == 201);
        }
示例#2
0
        public void setup()
        {
            created_containers = new List <string>();
            created_objects    = new List <Dictionary <string, string> >();
            client             = new SwiftClient();
            var res = client.GetAuth(auth_url, user_name, api_key, new Dictionary <string, string>(), new Dictionary <string, string>(), false);

            auth_token  = res.Headers["x-auth-token"];
            storage_url = res.Headers["x-storage-url"];
        }
示例#3
0
        public void test_get_auth()
        {
            var res = client.GetAuth(auth_url, user_name, api_key, new Dictionary <string, string>(), new Dictionary <string, string>(), false);

            foreach (var header in auth_headers)
            {
                Assert.IsTrue(res.Headers.ContainsKey(header), "Header: " + header);
            }
            Assert.IsTrue(res.Status < 300 || res.Status > 199);
            res = client.GetAuth(auth_url, user_name, api_key, new Dictionary <string, string>(), new Dictionary <string, string>(), true);
            foreach (var header in auth_headers)
            {
                Assert.IsTrue(res.Headers.ContainsKey(header), "Header: " + header);
            }
            Assert.IsTrue(res.Status < 300 && res.Status > 199);
            var index = res.Headers["x-storage-url"].IndexOf(snet_pattern, StringComparison.Ordinal);

            //Make Sure snet- was added to the right part of the url
            Assert.IsTrue(index > 3 && index < 6);
            Assert.IsTrue(index != -1);
        }
 public void setup()
 {
     created_containers = new List<string>();
     created_objects = new List<Dictionary<string, string>>();
     client = new SwiftClient();
     var res = client.GetAuth(auth_url, user_name, api_key, new Dictionary<string, string>(), new Dictionary<string, string>(), false);
     auth_token = res.Headers["x-auth-token"];
     storage_url = res.Headers["x-storage-url"];
 }