begin_unit
comment|'# Copyright 2016 HPE, Inc.'
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|'oslo_config'
name|'import'
name|'cfg'
newline|'\n'
nl|'\n'
name|'import'
name|'nova'
op|'.'
name|'scheduler'
op|'.'
name|'utils'
newline|'\n'
name|'import'
name|'nova'
op|'.'
name|'servicegroup'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'test'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
name|'import'
name|'fixtures'
name|'as'
name|'nova_fixtures'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'functional'
op|'.'
name|'api'
name|'import'
name|'client'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
name|'import'
name|'cast_as_call'
newline|'\n'
name|'import'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'image'
op|'.'
name|'fake'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
name|'import'
name|'policy_fixture'
newline|'\n'
nl|'\n'
DECL|variable|CONF
name|'CONF'
op|'='
name|'cfg'
op|'.'
name|'CONF'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|TestServerGet
name|'class'
name|'TestServerGet'
op|'('
name|'test'
op|'.'
name|'TestCase'
op|')'
op|':'
newline|'\n'
DECL|variable|REQUIRES_LOCKING
indent|'    '
name|'REQUIRES_LOCKING'
op|'='
name|'True'
newline|'\n'
nl|'\n'
DECL|member|setUp
name|'def'
name|'setUp'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'super'
op|'('
name|'TestServerGet'
op|','
name|'self'
op|')'
op|'.'
name|'setUp'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'useFixture'
op|'('
name|'policy_fixture'
op|'.'
name|'RealPolicyFixture'
op|'('
op|')'
op|')'
newline|'\n'
name|'api_fixture'
op|'='
name|'self'
op|'.'
name|'useFixture'
op|'('
name|'nova_fixtures'
op|'.'
name|'OSAPIFixture'
op|'('
nl|'\n'
name|'api_version'
op|'='
string|"'v2.1'"
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'api'
op|'='
name|'api_fixture'
op|'.'
name|'api'
newline|'\n'
nl|'\n'
comment|'# the image fake backend needed for image discovery'
nl|'\n'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'image'
op|'.'
name|'fake'
op|'.'
name|'stub_out_image_service'
op|'('
name|'self'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'start_service'
op|'('
string|"'conductor'"
op|','
name|'manager'
op|'='
name|'CONF'
op|'.'
name|'conductor'
op|'.'
name|'manager'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'flags'
op|'('
name|'scheduler_driver'
op|'='
string|"'chance_scheduler'"
op|')'
newline|'\n'
name|'self'
op|'.'
name|'start_service'
op|'('
string|"'scheduler'"
op|')'
newline|'\n'
name|'self'
op|'.'
name|'network'
op|'='
name|'self'
op|'.'
name|'start_service'
op|'('
string|"'network'"
op|')'
newline|'\n'
name|'self'
op|'.'
name|'compute'
op|'='
name|'self'
op|'.'
name|'start_service'
op|'('
string|"'compute'"
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'useFixture'
op|'('
name|'cast_as_call'
op|'.'
name|'CastAsCall'
op|'('
name|'self'
op|'.'
name|'stubs'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'addCleanup'
op|'('
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'image'
op|'.'
name|'fake'
op|'.'
name|'FakeImageService_reset'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'image_id'
op|'='
name|'self'
op|'.'
name|'api'
op|'.'
name|'get_images'
op|'('
op|')'
op|'['
number|'0'
op|']'
op|'['
string|"'id'"
op|']'
newline|'\n'
name|'self'
op|'.'
name|'flavor_id'
op|'='
name|'self'
op|'.'
name|'api'
op|'.'
name|'get_flavors'
op|'('
op|')'
op|'['
number|'0'
op|']'
op|'['
string|"'id'"
op|']'
newline|'\n'
nl|'\n'
DECL|member|test_id_overlap
dedent|''
name|'def'
name|'test_id_overlap'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Regression test for bug #1522536.\n\n        Before fixing this bug, getting a numeric id caused a 500\n        error because it treated the numeric value as the db index,\n        fetched the server, but then processing of extensions blew up.\n\n        Since we have fixed this bug it returns a 404, which is\n        expected. In future a 400 might be more appropriate.\n        """'
newline|'\n'
name|'server'
op|'='
name|'dict'
op|'('
name|'name'
op|'='
string|"'server1'"
op|','
nl|'\n'
name|'imageRef'
op|'='
name|'self'
op|'.'
name|'image_id'
op|','
nl|'\n'
name|'flavorRef'
op|'='
name|'self'
op|'.'
name|'flavor_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'api'
op|'.'
name|'post_server'
op|'('
op|'{'
string|"'server'"
op|':'
name|'server'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'client'
op|'.'
name|'OpenStackApiNotFoundException'
op|','
nl|'\n'
name|'self'
op|'.'
name|'api'
op|'.'
name|'get_server'
op|','
number|'1'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
