def test_browse_gets_specified_path(self):
        c = VCloudAPIClient()
        self.register_response('get',
                               API_ROOT + '/wibble',
                               200,
                               content='BAZ BAT')

        res = c.browse('/wibble')
        assert_equal(res.content, 'BAZ BAT')
def browse(args):
    """
    Browse the vCloud API using the built-in hypermedia links
    """
    c = VCloudAPIClient()
    res = c.browse(args.path)

    print('HTTP/1.1 {0} {1}'.format(res.status_code, res.reason))

    for k, v in res.headers.items():
        print("{0}: {1}".format(k, v))

    print()
    print(res.content)
Esempio n. 3
0
def browse(args):
    """
    Browse the vCloud API using the built-in hypermedia links
    """
    c = VCloudAPIClient()
    res = c.browse(args.path)

    print('HTTP/1.1 {0} {1}'.format(res.status_code, res.reason))

    for k, v in res.headers.items():
        print("{0}: {1}".format(k, v))

    print()
    print(res.content)
    def test_browse_gets_api_root_with_no_args(self):
        c = VCloudAPIClient()
        self.register_response('get', API_ROOT + '/', 200, content='FOO BAR')

        res = c.browse()
        assert_equal(res.content, 'FOO BAR')
Esempio n. 5
0
    def test_browse_gets_specified_path(self):
        c = VCloudAPIClient()
        self.register_response('get', API_ROOT + '/wibble', 200, content='BAZ BAT')

        res = c.browse('/wibble')
        assert_equal(res.content, 'BAZ BAT')
Esempio n. 6
0
    def test_browse_gets_api_root_with_no_args(self):
        c = VCloudAPIClient()
        self.register_response('get', API_ROOT + '/', 200, content='FOO BAR')

        res = c.browse()
        assert_equal(res.content, 'FOO BAR')