コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 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)
コード例 #6
0
 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)
コード例 #7
0
 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)
コード例 #8
0
 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)
コード例 #9
0
 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)
コード例 #10
0
 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)
コード例 #11
0
 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)
コード例 #12
0
 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)