diff options
author | Zuul <zuul@review.openstack.org> | 2018-07-26 09:24:06 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-07-26 09:24:06 +0000 |
commit | 2a66f9a7150cd92e45f29bb028b60863a27fa443 (patch) | |
tree | 1c8a2a2cfa6b0859b332e1329c2f0c59696758cc /saharaclient/tests/unit/osc | |
parent | 1630744a18d4a4886c32013969c2bdeafec4e6e6 (diff) | |
parent | 8222ccf0c5b576fcd9ceb62db2b2d3a269421775 (diff) | |
download | python-saharaclient-2a66f9a7150cd92e45f29bb028b60863a27fa443.tar.gz |
Diffstat (limited to 'saharaclient/tests/unit/osc')
-rw-r--r-- | saharaclient/tests/unit/osc/v1/test_data_sources.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/saharaclient/tests/unit/osc/v1/test_data_sources.py b/saharaclient/tests/unit/osc/v1/test_data_sources.py index bc0473f..8753206 100644 --- a/saharaclient/tests/unit/osc/v1/test_data_sources.py +++ b/saharaclient/tests/unit/osc/v1/test_data_sources.py @@ -15,6 +15,7 @@ import mock from osc_lib.tests import utils as osc_utils +import testtools from saharaclient.api import data_sources as api_ds from saharaclient.osc.v1 import data_sources as osc_ds @@ -65,7 +66,8 @@ class TestCreateDataSource(TestDataSources): 'data_source_type': 'swift', 'name': 'source', 'description': '', 'url': 'swift://container.sahara/object', - 'is_public': False, 'is_protected': False} + 'is_public': False, 'is_protected': False, + 's3_credentials': None} self.ds_mock.create.assert_called_once_with(**called_args) # Check that columns are correct @@ -98,7 +100,8 @@ class TestCreateDataSource(TestDataSources): 'data_source_type': 'swift', 'name': 'source', 'description': 'Data Source for tests', 'url': 'swift://container.sahara/object', - 'is_protected': True, 'is_public': True} + 'is_protected': True, 'is_public': True, + 's3_credentials': None} self.ds_mock.create.assert_called_once_with(**called_args) # Check that columns are correct @@ -111,6 +114,13 @@ class TestCreateDataSource(TestDataSources): 'swift', 'swift://container.sahara/object') self.assertEqual(expected_data, data) + def test_data_source_create_mutual_exclusion(self): + arglist = ['data-source', '--name', 'data-source', '--access-key', + 'ak', '--secret-key', 'sk', '--url', 's3a://abc/def', + '--password', 'pw'] + with testtools.ExpectedException(osc_utils.ParserException): + self.check_parser(self.cmd, arglist, mock.Mock()) + class TestListDataSources(TestDataSources): def setUp(self): @@ -304,3 +314,11 @@ class TestUpdateDataSource(TestDataSources): # Check that data source was created with correct arguments self.ds_mock.update.assert_called_once_with( 'id', {'is_public': False, 'is_protected': False}) + + def test_data_source_update_mutual_exclusion(self): + arglist = ['data-source', '--name', 'data-source', '--access-key', + 'ak', '--secret-key', 'sk', '--url', 's3a://abc/def', + '--password', 'pw'] + + with testtools.ExpectedException(osc_utils.ParserException): + self.check_parser(self.cmd, arglist, mock.Mock()) |