Skip to content

Instantly share code, notes, and snippets.

@cooper6581
Created April 25, 2019 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cooper6581/467f982a0a44494ca32d0c2f755112bc to your computer and use it in GitHub Desktop.
Save cooper6581/467f982a0a44494ca32d0c2f755112bc to your computer and use it in GitHub Desktop.
nova url format test
@mock.patch.object(cell_mapping.CellMapping, '_get_by_uuid_from_db')
def test_non_formatted_url_with_base(self, mock_get):
# Make sure we just pass through the template URL if the base
# URLs are set, i.e. we don't try to format the URL to a template.
url = 'foo{'
self.flags(transport_url=url)
self.flags(connection=None, group='database')
db_mapping = get_db_mapping(transport_url=url,
database_connection=url)
mock_get.return_value = db_mapping
mapping_obj = objects.CellMapping().get_by_uuid(self.context,
db_mapping['uuid'])
self.assertEqual(url, mapping_obj.database_connection)
self.assertEqual(url, mapping_obj.transport_url)
mock_format.assert_not_called()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment