Exemplo n.º 1
0
    def test_when_host_href_is_not_set_in_conf(self):
        cmn_utils.CONF.set_override('host_href', '')
        host_hdr = 'http://myproxy.server.com:9311'
        utils.mock_pecan_request(self, host=host_hdr)
        dummy_root = 'http://mylocalhost:9999'
        resp = self.app.get(dummy_root)

        versions_response = resp.json['versions']['values']

        for v_info in versions_response:
            self.assertIn(host_hdr, v_info['links'][0]['href'])
            self.assertNotIn(dummy_root, v_info['links'][0]['href'])
Exemplo n.º 2
0
    def test_when_host_href_is_not_set_with_general_request_url(self):
        cmn_utils.CONF.set_override('host_href', '')
        host_hdr = 'http://myproxy.server.com/key-manager'
        utils.mock_pecan_request(self, host=host_hdr)
        dummy_root = 'http://mylocalhost:9999'
        resp = self.app.get(dummy_root)

        versions_response = resp.json['versions']['values']

        for v_info in versions_response:
            self.assertIn(host_hdr, v_info['links'][0]['href'])
            self.assertNotIn(dummy_root, v_info['links'][0]['href'])
Exemplo n.º 3
0
    def setUp(self):
        super(WhenTestingHostByWsgiRequestForRefsGetter, self).setUp()

        self._old_version = utils.API_VERSION
        self.host = 'http://my_host:9311'
        self.version = 'version1'
        self.external_project_id = 'external_project_id'
        self.resource = 'my_resource'

        test_utils.mock_pecan_request(self, host=self.host)

        utils.CONF.set_override('host_href', None, enforce_type=True)
        utils.API_VERSION = self.version
Exemplo n.º 4
0
    def setUp(self):
        super(WhenTestingHostByWsgiRequestForRefsGetter, self).setUp()

        self._old_version = utils.API_VERSION
        self.host = 'http://my_host:9311'
        self.version = 'version1'
        self.external_project_id = 'external_project_id'
        self.resource = 'my_resource'

        test_utils.mock_pecan_request(self, host=self.host)

        utils.CONF.set_override('host_href', None)
        utils.API_VERSION = self.version
Exemplo n.º 5
0
    def test_when_host_href_is_not_set_with_general_request_url_v1(self):
        cmn_utils.CONF.set_override('host_href', '')
        host_hdr = 'http://myproxy.server.com/key-manager'
        utils.mock_pecan_request(self, host=host_hdr, version='1.1')
        dummy_root = 'http://mylocalhost:9999'
        resp = self.app.get(dummy_root)

        versions_response = resp.json['versions']

        for v_info in versions_response:
            self.assertEqual('1.0', v_info['min_version'])
            self.assertIn('max_version', v_info)
            self.assertIn(host_hdr, v_info['links'][0]['href'])
            self.assertNotIn(dummy_root, v_info['links'][0]['href'])
Exemplo n.º 6
0
    def test_when_host_href_is_set_in_conf(self):
        host_href = 'http://myapp.server.com:9311/'
        cmn_utils.CONF.set_override('host_href', host_href)
        host_hdr = 'http://myproxy.server.com:9311'
        utils.mock_pecan_request(self, host=host_hdr)
        dummy_root = 'http://mylocalhost:9999'
        resp = self.app.get(dummy_root)

        versions_response = resp.json['versions']['values']

        for v_info in versions_response:
            self.assertIn(host_href, v_info['links'][0]['href'])
            self.assertNotIn(dummy_root, v_info['links'][0]['href'])
            self.assertNotIn(host_hdr, v_info['links'][0]['href'])
Exemplo n.º 7
0
    def test_when_host_href_is_general_v0(self):
        host_href = 'http://myapp.server.com/key-manager'
        cmn_utils.CONF.set_override('host_href', host_href)
        host_hdr = 'http://myproxy.server.com:9311'
        utils.mock_pecan_request(self, host=host_hdr)
        dummy_root = 'http://mylocalhost:9999'
        resp = self.app.get(dummy_root)

        versions_response = resp.json['versions']['values']

        for v_info in versions_response:
            self.assertNotIn('min_version', v_info)
            self.assertNotIn('max_version', v_info)
            self.assertIn(host_href, v_info['links'][0]['href'])
            self.assertNotIn(dummy_root, v_info['links'][0]['href'])
            self.assertNotIn(host_hdr, v_info['links'][0]['href'])
Exemplo n.º 8
0
    def test_when_host_href_is_set_in_conf_v1(self):
        host_href = 'http://myapp.server.com:9311/'
        cmn_utils.CONF.set_override('host_href', host_href)
        host_hdr = 'http://myproxy.server.com:9311'
        utils.mock_pecan_request(self, host=host_hdr, version='1.1')
        dummy_root = 'http://mylocalhost:9999'
        resp = self.app.get(dummy_root)

        versions_response = resp.json['versions']

        for v_info in versions_response:
            self.assertEqual('1.0', v_info['min_version'])
            self.assertIn('max_version', v_info)
            self.assertIn(host_href, v_info['links'][0]['href'])
            self.assertNotIn(dummy_root, v_info['links'][0]['href'])
            self.assertNotIn(host_hdr, v_info['links'][0]['href'])