Exemplo n.º 1
0
 def test_get_uri_with_endpoint_bucket_and_object(self):
     endpoint = AWSServiceEndpoint("http://localhost/")
     url_context = client.URLContext(
         endpoint, bucket="mydocs", object_name="notes.txt")
     self.assertEquals(
         url_context.get_url(),
         "http://localhost/mydocs/notes.txt")
Exemplo n.º 2
0
 def test_custom_port_endpoint_https(self):
     test_uri='https://0.0.0.0:12345/'
     endpoint = AWSServiceEndpoint(uri=test_uri)
     self.assertEquals(endpoint.port, 12345)
     self.assertEquals(endpoint.scheme, 'https')
     context = client.URLContext(service_endpoint=endpoint,
             bucket="foo",
             object_name="bar")
     self.assertEquals(context.get_host(), '0.0.0.0')
     self.assertEquals(context.get_url(), test_uri + 'foo/bar')
Exemplo n.º 3
0
 def test_get_url_with_custom_endpoint(self):
     endpoint = AWSServiceEndpoint("http://localhost/")
     url_context = client.URLContext(endpoint)
     self.assertEquals(url_context.endpoint.get_uri(), "http://localhost/")
     self.assertEquals(url_context.get_url(), "http://localhost/")
Exemplo n.º 4
0
 def test_get_path_with_bucket_and_object_without_slash(self):
     url_context = client.URLContext(
         self.endpoint, bucket="mystuff", object_name="images/thing.jpg")
     self.assertEquals(url_context.get_host(), "s3.amazonaws.com")
     self.assertEquals(url_context.get_path(), "/mystuff/images/thing.jpg")
Exemplo n.º 5
0
 def test_get_path_with_bucket(self):
     url_context = client.URLContext(self.endpoint, bucket="mystuff")
     self.assertEquals(url_context.get_path(), "/mystuff/")
Exemplo n.º 6
0
 def test_get_path_with_no_bucket(self):
     url_context = client.URLContext(self.endpoint)
     self.assertEquals(url_context.get_path(), "/")
Exemplo n.º 7
0
 def test_get_host_with_bucket(self):
     url_context = client.URLContext(self.endpoint, "mystuff")
     self.assertEquals(url_context.get_host(), "s3.amazonaws.com")