def test_stat_object_verbose(self):
        self.options.verbose += 1
        # stub head object request
        stub_headers = {
            "content-length": 2 ** 20,
            "x-object-meta-color": "blue",
            "etag": "68b329da9893e34099c7d8ad5cb9c940",
            "content-encoding": "gzip",
        }
        self.conn.head_object.return_value = stub_headers
        args = ("c", "o")
        with self.thread_manager as thread_manager:
            h.stat_object(self.conn, self.options, args, thread_manager)
        expected = """
           URL: http://storage/v1/a/c/o
    Auth Token: tk12345
       Account: a
     Container: c
        Object: o
Content Length: 1048576
          ETag: 68b329da9893e34099c7d8ad5cb9c940
    Meta Color: blue
Content-Encoding: gzip
"""
        self.assertOut(expected)
Пример #2
0
    def test_stat_object_verbose(self):
        self.options.verbose += 1
        # stub head object request
        stub_headers = {
            'content-length': 2**20,
            'x-object-meta-color': 'blue',
            'etag': '68b329da9893e34099c7d8ad5cb9c940',
            'content-encoding': 'gzip',
        }
        self.conn.head_object.return_value = stub_headers
        args = ('c', 'o')
        with self.thread_manager as thread_manager:
            h.stat_object(self.conn, self.options, args, thread_manager)
        expected = """
           URL: http://storage/v1/a/c/o
    Auth Token: tk12345
       Account: a
     Container: c
        Object: o
Content Length: 1048576
          ETag: 68b329da9893e34099c7d8ad5cb9c940
    Meta Color: blue
Content-Encoding: gzip
"""
        self.assertOut(expected)
    def test_stat_object_verbose(self):
        self.options['verbose'] += 1
        # stub head object request
        stub_headers = {
            'content-length': 2 ** 20,
            'x-object-meta-color': 'blue',
            'etag': '68b329da9893e34099c7d8ad5cb9c940',
            'content-encoding': 'gzip',
        }
        self.conn.head_object.return_value = stub_headers
        args = ('c', 'o')
        with self.output_manager as output_manager:
            items, headers = h.stat_object(self.conn, self.options, *args)
            h.print_object_stats(items, headers, output_manager)
        expected = """
             URL: http://storage/v1/a/c/o
      Auth Token: tk12345
         Account: a
       Container: c
          Object: o
  Content Length: 1048576
            ETag: 68b329da9893e34099c7d8ad5cb9c940
      Meta Color: blue
Content-Encoding: gzip
"""
        self.assertOut(expected)
    def test_stat_object_human(self):
        self.options.human = True
        # stub head object request
        stub_headers = {
            "content-length": 2 ** 20,
            "x-object-meta-color": "blue",
            "etag": "68b329da9893e34099c7d8ad5cb9c940",
            "content-encoding": "gzip",
        }
        self.conn.head_object.return_value = stub_headers
        args = ("c", "o")
        with self.thread_manager as thread_manager:
            h.stat_object(self.conn, self.options, args, thread_manager)
        expected = """
       Account: a
     Container: c
        Object: o
Content Length: 1.0M
          ETag: 68b329da9893e34099c7d8ad5cb9c940
    Meta Color: blue
Content-Encoding: gzip
"""
        self.assertOut(expected)
    def test_stat_object_human(self):
        self.options.human = True
        # stub head object request
        stub_headers = {
            'content-length': 2 ** 20,
            'x-object-meta-color': 'blue',
            'etag': '68b329da9893e34099c7d8ad5cb9c940',
            'content-encoding': 'gzip',
        }
        self.conn.head_object.return_value = stub_headers
        args = ('c', 'o')
        with self.thread_manager as thread_manager:
            h.stat_object(self.conn, self.options, args, thread_manager)
        expected = """
       Account: a
     Container: c
        Object: o
Content Length: 1.0M
          ETag: 68b329da9893e34099c7d8ad5cb9c940
    Meta Color: blue
Content-Encoding: gzip
"""
        self.assertOut(expected)
Пример #6
0
    def test_stat_object_human(self):
        self.options.human = True
        # stub head object request
        stub_headers = {
            'content-length': 2**20,
            'x-object-meta-color': 'blue',
            'etag': '68b329da9893e34099c7d8ad5cb9c940',
            'content-encoding': 'gzip',
        }
        self.conn.head_object.return_value = stub_headers
        args = ('c', 'o')
        with self.thread_manager as thread_manager:
            h.stat_object(self.conn, self.options, args, thread_manager)
        expected = """
       Account: a
     Container: c
        Object: o
Content Length: 1.0M
          ETag: 68b329da9893e34099c7d8ad5cb9c940
    Meta Color: blue
Content-Encoding: gzip
"""
        self.assertOut(expected)