text: begin_unit
  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_utils'
  name|'import'
  name|'uuidutils'
  newline|'\n'
  nl|'\n'
  name|'from'
  name|'nova'
  name|'import'
  name|'context'
  newline|'\n'
  name|'from'
  name|'nova'
  name|'import'
  name|'exception'
  newline|'\n'
  name|'from'
  name|'nova'
  op|'.'
  name|'objects'
  name|'import'
  name|'cell_mapping'
  newline|'\n'
  name|'from'
  name|'nova'
  name|'import'
  name|'test'
  newline|'\n'
  name|'from'
  name|'nova'
  op|'.'
  name|'tests'
  name|'import'
  name|'fixtures'
  newline|'\n'
  nl|'\n'
  nl|'\n'
  DECL|class|CellMappingTestCase
  name|'class'
  name|'CellMappingTestCase'
  op|'('
  name|'test'
  op|'.'
  name|'NoDBTestCase'
  op|')'
  op|':'
  newline|'\n'
  DECL|variable|USES_DB_SELF
  indent|'    '
  name|'USES_DB_SELF'
  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|'CellMappingTestCase'
  op|','
  name|'self'
  op|')'
  op|'.'
  name|'setUp'
  op|'('
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'useFixture'
  op|'('
  name|'fixtures'
  op|'.'
  name|'Database'
  op|'('
  name|'database'
  op|'='
  string|"'api'"
  op|')'
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'context'
  op|'='
  name|'context'
  op|'.'
  name|'RequestContext'
  op|'('
  string|"'fake-user'"
  op|','
  string|"'fake-project'"
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'='
  name|'cell_mapping'
  op|'.'
  name|'CellMapping'
  op|'('
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'uuid'
  op|'='
  name|'uuidutils'
  op|'.'
  name|'generate_uuid'
  op|'('
  op|')'
  newline|'\n'
  nl|'\n'
  DECL|variable|sample_mapping
  dedent|''
  name|'sample_mapping'
  op|'='
  op|'{'
  string|"'uuid'"
  op|':'
  string|"''"
  op|','
  nl|'\n'
  string|"'name'"
  op|':'
  string|"'fake-cell'"
  op|','
  nl|'\n'
  string|"'transport_url'"
  op|':'
  string|"'rabbit:///'"
  op|','
  nl|'\n'
  string|"'database_connection'"
  op|':'
  string|"'mysql+pymysql:///'"
  op|'}'
  newline|'\n'
  nl|'\n'
  DECL|member|_create_mapping
  name|'def'
  name|'_create_mapping'
  op|'('
  name|'self'
  op|','
  op|'**'
  name|'kwargs'
  op|')'
  op|':'
  newline|'\n'
  indent|'        '
  name|'args'
  op|'='
  name|'self'
  op|'.'
  name|'sample_mapping'
  op|'.'
  name|'copy'
  op|'('
  op|')'
  newline|'\n'
  name|'if'
  string|"'uuid'"
  name|'not'
  name|'in'
  name|'kwargs'
  op|':'
  newline|'\n'
  indent|'            '
  name|'args'
  op|'['
  string|"'uuid'"
  op|']'
  op|'='
  name|'self'
  op|'.'
  name|'uuid'
  newline|'\n'
  dedent|''
  name|'args'
  op|'.'
  name|'update'
  op|'('
  name|'kwargs'
  op|')'
  newline|'\n'
  name|'return'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_create_in_db'
  op|'('
  name|'self'
  op|'.'
  name|'context'
  op|','
  name|'args'
  op|')'
  newline|'\n'
  nl|'\n'
  DECL|member|test_get_by_uuid
  dedent|''
  name|'def'
  name|'test_get_by_uuid'
  op|'('
  name|'self'
  op|')'
  op|':'
  newline|'\n'
  indent|'        '
  name|'mapping'
  op|'='
  name|'self'
  op|'.'
  name|'_create_mapping'
  op|'('
  op|')'
  newline|'\n'
  name|'db_mapping'
  op|'='
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_get_by_uuid_from_db'
  op|'('
  name|'self'
  op|'.'
  name|'context'
  op|','
  nl|'\n'
  name|'mapping'
  op|'['
  string|"'uuid'"
  op|']'
  op|')'
  newline|'\n'
  name|'for'
  name|'key'
  name|'in'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'fields'
  op|'.'
  name|'keys'
  op|'('
  op|')'
  op|':'
  newline|'\n'
  indent|'            '
  name|'self'
  op|'.'
  name|'assertEqual'
  op|'('
  name|'db_mapping'
  op|'['
  name|'key'
  op|']'
  op|','
  name|'mapping'
  op|'['
  name|'key'
  op|']'
  op|')'
  newline|'\n'
  nl|'\n'
  DECL|member|test_get_by_uuid_not_found
  dedent|''
  dedent|''
  name|'def'
  name|'test_get_by_uuid_not_found'
  op|'('
  name|'self'
  op|')'
  op|':'
  newline|'\n'
  indent|'        '
  name|'self'
  op|'.'
  name|'assertRaises'
  op|'('
  name|'exception'
  op|'.'
  name|'CellMappingNotFound'
  op|','
  nl|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_get_by_uuid_from_db'
  op|','
  name|'self'
  op|'.'
  name|'context'
  op|','
  name|'self'
  op|'.'
  name|'uuid'
  op|')'
  newline|'\n'
  nl|'\n'
  DECL|member|test_save_in_db
  dedent|''
  name|'def'
  name|'test_save_in_db'
  op|'('
  name|'self'
  op|')'
  op|':'
  newline|'\n'
  indent|'        '
  name|'mapping'
  op|'='
  name|'self'
  op|'.'
  name|'_create_mapping'
  op|'('
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_save_in_db'
  op|'('
  name|'self'
  op|'.'
  name|'context'
  op|','
  name|'mapping'
  op|'['
  string|"'uuid'"
  op|']'
  op|','
  nl|'\n'
  op|'{'
  string|"'name'"
  op|':'
  string|"'meow'"
  op|'}'
  op|')'
  newline|'\n'
  name|'db_mapping'
  op|'='
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_get_by_uuid_from_db'
  op|'('
  name|'self'
  op|'.'
  name|'context'
  op|','
  nl|'\n'
  name|'mapping'
  op|'['
  string|"'uuid'"
  op|']'
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'assertNotEqual'
  op|'('
  name|'db_mapping'
  op|'['
  string|"'name'"
  op|']'
  op|','
  name|'mapping'
  op|'['
  string|"'name'"
  op|']'
  op|')'
  newline|'\n'
  name|'for'
  name|'key'
  name|'in'
  op|'['
  name|'key'
  name|'for'
  name|'key'
  name|'in'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'fields'
  op|'.'
  name|'keys'
  op|'('
  op|')'
  nl|'\n'
  name|'if'
  name|'key'
  name|'not'
  name|'in'
  op|'['
  string|"'name'"
  op|','
  string|"'updated_at'"
  op|']'
  op|']'
  op|':'
  newline|'\n'
  indent|'            '
  name|'self'
  op|'.'
  name|'assertEqual'
  op|'('
  name|'db_mapping'
  op|'['
  name|'key'
  op|']'
  op|','
  name|'mapping'
  op|'['
  name|'key'
  op|']'
  op|')'
  newline|'\n'
  nl|'\n'
  DECL|member|test_destroy_in_db
  dedent|''
  dedent|''
  name|'def'
  name|'test_destroy_in_db'
  op|'('
  name|'self'
  op|')'
  op|':'
  newline|'\n'
  indent|'        '
  name|'mapping'
  op|'='
  name|'self'
  op|'.'
  name|'_create_mapping'
  op|'('
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_get_by_uuid_from_db'
  op|'('
  name|'self'
  op|'.'
  name|'context'
  op|','
  name|'mapping'
  op|'['
  string|"'uuid'"
  op|']'
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_destroy_in_db'
  op|'('
  name|'self'
  op|'.'
  name|'context'
  op|','
  name|'mapping'
  op|'['
  string|"'uuid'"
  op|']'
  op|')'
  newline|'\n'
  name|'self'
  op|'.'
  name|'assertRaises'
  op|'('
  name|'exception'
  op|'.'
  name|'CellMappingNotFound'
  op|','
  nl|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_get_by_uuid_from_db'
  op|','
  name|'self'
  op|'.'
  name|'context'
  op|','
  nl|'\n'
  name|'mapping'
  op|'['
  string|"'uuid'"
  op|']'
  op|')'
  newline|'\n'
  nl|'\n'
  DECL|member|test_destroy_in_db_not_found
  dedent|''
  name|'def'
  name|'test_destroy_in_db_not_found'
  op|'('
  name|'self'
  op|')'
  op|':'
  newline|'\n'
  indent|'        '
  name|'self'
  op|'.'
  name|'assertRaises'
  op|'('
  name|'exception'
  op|'.'
  name|'CellMappingNotFound'
  op|','
  nl|'\n'
  name|'self'
  op|'.'
  name|'mapping_obj'
  op|'.'
  name|'_destroy_in_db'
  op|','
  name|'self'
  op|'.'
  name|'context'
  op|','
  name|'self'
  op|'.'
  name|'uuid'
  op|')'
  newline|'\n'
  dedent|''
  dedent|''
  endmarker|''
  end_unit
  