begin_unit
comment|'# Copyright 2014 IBM Corp.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#    Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'#    not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'#    a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#         http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#    Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'#    License for the specific language governing permissions and limitations'
nl|'\n'
comment|'#    under the License.'
nl|'\n'
nl|'\n'
name|'from'
name|'nova'
op|'.'
name|'api'
op|'.'
name|'openstack'
name|'import'
name|'api_version_request'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'exception'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'test'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'api'
op|'.'
name|'openstack'
name|'import'
name|'fakes'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|APIVersionRequestTests
name|'class'
name|'APIVersionRequestTests'
op|'('
name|'test'
op|'.'
name|'NoDBTestCase'
op|')'
op|':'
newline|'\n'
DECL|member|test_valid_version_strings
indent|'    '
name|'def'
name|'test_valid_version_strings'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
DECL|function|_test_string
indent|'        '
name|'def'
name|'_test_string'
op|'('
name|'version'
op|','
name|'exp_major'
op|','
name|'exp_minor'
op|')'
op|':'
newline|'\n'
indent|'            '
name|'v'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
name|'version'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'v'
op|'.'
name|'ver_major'
op|','
name|'exp_major'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'v'
op|'.'
name|'ver_minor'
op|','
name|'exp_minor'
op|')'
newline|'\n'
nl|'\n'
dedent|''
name|'_test_string'
op|'('
string|'"1.1"'
op|','
number|'1'
op|','
number|'1'
op|')'
newline|'\n'
name|'_test_string'
op|'('
string|'"2.10"'
op|','
number|'2'
op|','
number|'10'
op|')'
newline|'\n'
name|'_test_string'
op|'('
string|'"5.234"'
op|','
number|'5'
op|','
number|'234'
op|')'
newline|'\n'
name|'_test_string'
op|'('
string|'"12.5"'
op|','
number|'12'
op|','
number|'5'
op|')'
newline|'\n'
name|'_test_string'
op|'('
string|'"2.0"'
op|','
number|'2'
op|','
number|'0'
op|')'
newline|'\n'
name|'_test_string'
op|'('
string|'"2.200"'
op|','
number|'2'
op|','
number|'200'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_null_version
dedent|''
name|'def'
name|'test_null_version'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'v'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'v'
op|'.'
name|'is_null'
op|'('
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_invalid_version_strings
dedent|''
name|'def'
name|'test_invalid_version_strings'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"2"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"200"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"2.1.4"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"200.23.66.3"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"5 .3"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"5. 3"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"5.03"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"02.1"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"2.001"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'""'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'" 2.1"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'InvalidAPIVersionString'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|','
string|'"2.1 "'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_version_comparisons
dedent|''
name|'def'
name|'test_version_comparisons'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'vers1'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.0"'
op|')'
newline|'\n'
name|'vers2'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.5"'
op|')'
newline|'\n'
name|'vers3'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"5.23"'
op|')'
newline|'\n'
name|'vers4'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.0"'
op|')'
newline|'\n'
name|'v_null'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'v_null'
op|'<'
name|'vers2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'<'
name|'vers2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'<='
name|'vers2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'<='
name|'vers4'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers2'
op|'>'
name|'v_null'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers3'
op|'>'
name|'vers2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'>='
name|'vers4'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers3'
op|'>='
name|'vers2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'!='
name|'vers2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'=='
name|'vers4'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'!='
name|'v_null'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'v_null'
op|'=='
name|'v_null'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'TypeError'
op|','
name|'vers1'
op|'.'
name|'__lt__'
op|','
string|'"2.1"'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_version_matches
dedent|''
name|'def'
name|'test_version_matches'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'vers1'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.0"'
op|')'
newline|'\n'
name|'vers2'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.5"'
op|')'
newline|'\n'
name|'vers3'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.45"'
op|')'
newline|'\n'
name|'vers4'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"3.3"'
op|')'
newline|'\n'
name|'vers5'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"3.23"'
op|')'
newline|'\n'
name|'vers6'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"2.0"'
op|')'
newline|'\n'
name|'vers7'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"3.3"'
op|')'
newline|'\n'
name|'vers8'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
string|'"4.0"'
op|')'
newline|'\n'
name|'v_null'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers2'
op|'.'
name|'matches'
op|'('
name|'vers1'
op|','
name|'vers3'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers2'
op|'.'
name|'matches'
op|'('
name|'vers1'
op|','
name|'v_null'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers1'
op|'.'
name|'matches'
op|'('
name|'vers6'
op|','
name|'vers2'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers4'
op|'.'
name|'matches'
op|'('
name|'vers2'
op|','
name|'vers7'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers4'
op|'.'
name|'matches'
op|'('
name|'v_null'
op|','
name|'vers7'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'vers4'
op|'.'
name|'matches'
op|'('
name|'v_null'
op|','
name|'vers8'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'vers1'
op|'.'
name|'matches'
op|'('
name|'vers2'
op|','
name|'vers3'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'vers5'
op|'.'
name|'matches'
op|'('
name|'vers2'
op|','
name|'vers4'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'vers2'
op|'.'
name|'matches'
op|'('
name|'vers3'
op|','
name|'vers1'
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'ValueError'
op|','
name|'v_null'
op|'.'
name|'matches'
op|','
name|'vers1'
op|','
name|'vers3'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_string
dedent|''
name|'def'
name|'test_get_string'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'vers1_string'
op|'='
string|'"3.23"'
newline|'\n'
name|'vers1'
op|'='
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
name|'vers1_string'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'vers1_string'
op|','
name|'vers1'
op|'.'
name|'get_string'
op|'('
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'ValueError'
op|','
nl|'\n'
name|'api_version_request'
op|'.'
name|'APIVersionRequest'
op|'('
op|')'
op|'.'
name|'get_string'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_is_supported_min_version
dedent|''
name|'def'
name|'test_is_supported_min_version'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'req'
op|'='
name|'fakes'
op|'.'
name|'HTTPRequest'
op|'.'
name|'blank'
op|'('
string|"'/fake'"
op|','
name|'version'
op|'='
string|"'2.5'"
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.4'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.5'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.6'"
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_is_supported_max_version
dedent|''
name|'def'
name|'test_is_supported_max_version'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'req'
op|'='
name|'fakes'
op|'.'
name|'HTTPRequest'
op|'.'
name|'blank'
op|'('
string|"'/fake'"
op|','
name|'version'
op|'='
string|"'2.5'"
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'max_version'
op|'='
string|"'2.4'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'max_version'
op|'='
string|"'2.5'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'max_version'
op|'='
string|"'2.6'"
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_is_supported_min_and_max_version
dedent|''
name|'def'
name|'test_is_supported_min_and_max_version'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'req'
op|'='
name|'fakes'
op|'.'
name|'HTTPRequest'
op|'.'
name|'blank'
op|'('
string|"'/fake'"
op|','
name|'version'
op|'='
string|"'2.5'"
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.3'"
op|','
name|'max_version'
op|'='
string|"'2.4'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.3'"
op|','
name|'max_version'
op|'='
string|"'2.5'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.3'"
op|','
name|'max_version'
op|'='
string|"'2.7'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.5'"
op|','
name|'max_version'
op|'='
string|"'2.7'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.6'"
op|','
name|'max_version'
op|'='
string|"'2.7'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.5'"
op|','
name|'max_version'
op|'='
string|"'2.5'"
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'api_version_request'
op|'.'
name|'is_supported'
op|'('
nl|'\n'
name|'req'
op|','
name|'min_version'
op|'='
string|"'2.10'"
op|','
name|'max_version'
op|'='
string|"'2.1'"
op|')'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
