Merge "Fix updating datasource without changing a name"
This commit is contained in:
commit
43f08a562b
|
@ -118,10 +118,10 @@ def check_data_source_update(data, data_source_id):
|
|||
_("DataSource is used in a "
|
||||
"PENDING Job and can not be updated."))
|
||||
|
||||
if 'name' in data:
|
||||
ds = c.API.data_source_get(ctx, data_source_id)
|
||||
if 'name' in data and data['name'] != ds.name:
|
||||
b.check_data_source_unique_name(data['name'])
|
||||
|
||||
ds = c.API.data_source_get(ctx, data_source_id)
|
||||
check_data = {'type': data.get('type', None) or ds.type,
|
||||
'url': data.get('url', None) or ds.url,
|
||||
'credentials': data.get(
|
||||
|
|
|
@ -401,7 +401,7 @@ class TestDataSourceUpdateValidation(u.ValidationTestCase):
|
|||
@mock.patch('sahara.conductor.API.job_execution_get_all')
|
||||
@mock.patch('sahara.conductor.API.data_source_get_all')
|
||||
@mock.patch('sahara.conductor.API.data_source_get')
|
||||
def test_update_data_source_name(self, je_all, ds_all, ds_get):
|
||||
def test_update_data_source_name(self, ds_get, ds_all, je_all):
|
||||
ds1 = mock.Mock()
|
||||
ds1.name = 'ds1'
|
||||
ds_all.return_value = [ds1]
|
||||
|
@ -411,6 +411,9 @@ class TestDataSourceUpdateValidation(u.ValidationTestCase):
|
|||
with testtools.ExpectedException(ex.NameAlreadyExistsException):
|
||||
ds.check_data_source_update({'name': 'ds'}, 'ds_id')
|
||||
|
||||
ds_get.return_value = ds1
|
||||
ds.check_data_source_update({'name': 'ds'}, 'ds_id')
|
||||
|
||||
@mock.patch('sahara.conductor.API.job_execution_get_all')
|
||||
@mock.patch('sahara.conductor.API.data_source_get')
|
||||
def test_update_data_source_swift(self, ds_get, je_all):
|
||||
|
|
Loading…
Reference in New Issue