base.py (ec2-api-12.0.0) | : | base.py (ec2-api-13.0.0) | ||
---|---|---|---|---|
skipping to change at line 57 | skipping to change at line 57 | |||
def skip_not_implemented(test_item): | def skip_not_implemented(test_item): | |||
def decorator(test_item): | def decorator(test_item): | |||
test_item.skip('The feature is not yet implemented') | test_item.skip('The feature is not yet implemented') | |||
return decorator | return decorator | |||
def create_context(is_os_admin=False): | def create_context(is_os_admin=False): | |||
session = (mock.sentinel.admin_session | session = (mock.sentinel.admin_session | |||
if is_os_admin else | if is_os_admin else | |||
mock.sentinel.session) | mock.sentinel.session) | |||
session.get_endpoint = mock.Mock(name="get_endpoint") | session.get_endpoint = mock.Mock(name="get_endpoint") | |||
session.get_endpoint.return_value = 'v2' | session.get_endpoint.return_value = 'v3' | |||
return ec2api.context.RequestContext(fakes.ID_OS_USER, fakes.ID_OS_PROJECT, | return ec2api.context.RequestContext(fakes.ID_OS_USER, fakes.ID_OS_PROJECT, | |||
is_os_admin=is_os_admin, | is_os_admin=is_os_admin, | |||
session=session) | session=session) | |||
class MockOSMixin(object): | class MockOSMixin(object): | |||
def mock(self, object_name): | def mock(self, object_name): | |||
patcher = mock.patch(object_name) | patcher = mock.patch(object_name) | |||
result = patcher.start() | result = patcher.start() | |||
self.addCleanup(patcher.stop) | self.addCleanup(patcher.stop) | |||
skipping to change at line 119 | skipping to change at line 119 | |||
def mock_glance(self): | def mock_glance(self): | |||
glance_patcher = mock.patch('glanceclient.client.Client') | glance_patcher = mock.patch('glanceclient.client.Client') | |||
with mock.patch('glanceclient.v2.schemas.Controller'): | with mock.patch('glanceclient.v2.schemas.Controller'): | |||
glance = mock.create_autospec(glanceclient.Client(endpoint='v2')) | glance = mock.create_autospec(glanceclient.Client(endpoint='v2')) | |||
glance_patcher.start().return_value = glance | glance_patcher.start().return_value = glance | |||
self.addCleanup(glance_patcher.stop) | self.addCleanup(glance_patcher.stop) | |||
return glance | return glance | |||
def mock_cinder(self): | def mock_cinder(self): | |||
cinder_patcher = mock.patch('cinderclient.client.Client') | cinder_patcher = mock.patch('cinderclient.client.Client') | |||
cinder = mock.create_autospec(cinderclient.Client('2')) | cinder = mock.create_autospec(cinderclient.Client('3')) | |||
cinder_patcher.start().return_value = cinder | cinder_patcher.start().return_value = cinder | |||
self.addCleanup(cinder_patcher.stop) | self.addCleanup(cinder_patcher.stop) | |||
return cinder | return cinder | |||
class MockDBMixin(object): | class MockDBMixin(object): | |||
def mock_db(self): | def mock_db(self): | |||
db_api_patcher = mock.patch('ec2api.db.api.IMPL', autospec=db_backend) | db_api_patcher = mock.patch('ec2api.db.api.IMPL', autospec=db_backend) | |||
db_api = db_api_patcher.start() | db_api = db_api_patcher.start() | |||
self.addCleanup(db_api_patcher.stop) | self.addCleanup(db_api_patcher.stop) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |