def test_model_suffix_not_configured( self, save_tenant_mock, get_tenants_list_mock ): save_tenant_mock.return_value = None tenants_list = TenantFactory.create_batch(5) get_tenants_list_mock.return_value = tenants_list result = openstack() self.assertEquals( result, (True, '5 OpenStack Tenants saved', {}) ) save_tenant_mock.assert_any_call( tenants_list[0].id, tenants_list[0].name, 'OpenStack Tenant' )
def test_openstack_plugin(self, save_tenant_mock, get_tenants_list_mock): save_tenant_mock.return_value = None tenants_list = TenantFactory.create_batch(5) get_tenants_list_mock.return_value = tenants_list result = openstack() self.assertEquals( result, (True, '5 OpenStack Tenants saved', {}) ) self.assertEquals(get_tenants_list_mock.call_count, 2) self.assertEquals(save_tenant_mock.call_count, 10) save_tenant_mock.assert_any_call( tenants_list[0].id, tenants_list[0].name, 'OpenStack Tenant Suffix1' ) for site in TEST_SETTINGS_SITES['OPENSTACK_SITES']: get_tenants_list_mock.assert_any_call(site)