def test_match_multiple_services(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'network 5.9 ,compute 2.1,telemetry 7.8', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual('2.1', version) version = microversion_parse.check_standard_header( headers, 'telemetry') self.assertEqual('7.8', version)
def test_match_multiple_services(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'network 5.9 ,compute 2.1,telemetry 7.8', 'header-two': 'beta', } version = microversion_parse.check_standard_header( headers, 'compute') self.assertEqual('2.1', version) version = microversion_parse.check_standard_header( headers, 'telemetry') self.assertEqual('7.8', version)
def test_match_multiple_services(self): headers = wb_headers.EnvironHeaders({ 'HTTP_HEADER_ONE': 'alpha', 'HTTP_OPENSTACK_API_VERSION': 'network 5.9 ,compute 2.1,telemetry 7.8', 'HTTP_HEADER_TWO': 'beta', }) version = microversion_parse.check_standard_header( headers, 'compute') self.assertEqual('2.1', version) version = microversion_parse.check_standard_header( headers, 'telemetry') self.assertEqual('7.8', version)
def test_no_match_no_value(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'compute ', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual(None, version)
def test_match_extra_whitespace(self): headers = { 'header-one': 'alpha', 'openstack-api-version': ' compute 2.1 ', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual('2.1', version)
def test_no_match_wrong_service(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'network 5.9 ', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual(None, version)
def test_match_extra_whitespace(self): headers = { 'header-one': 'alpha', 'openstack-api-version': ' compute 2.1 ', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual('2.1', version)
def test_match_multiple_same_service(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'compute 5.9 ,compute 2.1,compute 7.8', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual('7.8', version)
def test_simple_match(self): headers = wb_headers.EnvironHeaders({ 'HTTP_HEADER_ONE': 'alpha', 'HTTP_OPENSTACK_API_VERSION': 'compute 2.1', 'HTTP_HEADER_TWO': 'beta', }) version = microversion_parse.check_standard_header(headers, 'compute') self.assertEqual('2.1', version)
def test_match_multiple_same_service(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'compute 5.9 ,compute 2.1,compute 7.8', 'header-two': 'beta', } version = microversion_parse.check_standard_header( headers, 'compute') self.assertEqual('7.8', version)
def test_simple_match(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'compute 2.1', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') # TODO(cdent): String or number. Choosing string for now # since 'latest' is always a string. self.assertEqual('2.1', version)
def test_simple_match(self): headers = { 'header-one': 'alpha', 'openstack-api-version': 'compute 2.1', 'header-two': 'beta', } version = microversion_parse.check_standard_header(headers, 'compute') # TODO(cdent): String or number. Choosing string for now # since 'latest' is always a string. self.assertEqual('2.1', version)