def test_load_config_io_error(self): s = Settings(operation=ListOperation('gid', []), options=self._updated_opts({ 'config': 'tests/resources/test-artifact-cli.conf_no_such_file' })) self.assertEqual(s.load_config(), Settings())
def test_load_config_ok(self): s = Settings( operation=ListOperation('gid', []), options=self._updated_opts({'config': 'tests/resources/test-artifact-cli.conf', 'bucket': 'bucket4art'})) t = Settings( operation=ListOperation('gid', []), options=self._updated_opts({'config': 'tests/resources/test-artifact-cli.conf', 'bucket': 'bucket4art'}), repo=Repository(S3Driver('XXX', 'YYY', 'bucket4art', 'gid'), 'gid') ) self.assertEqual(s.load_config(), t)
def test_load_config_enough(self): s = Settings( operation=ListOperation('gid', []), options=self._updated_opts( {'access_key': 'ACCESS_KEY', 'secret_key': 'SECRET_KEY', 'bucket': 'BUCKET'}) ) t = Settings( operation=ListOperation('gid', []), options=self._updated_opts( {'access_key': 'ACCESS_KEY', 'secret_key': 'SECRET_KEY', 'bucket': 'BUCKET'}), repo=Repository(S3Driver('ACCESS_KEY', 'SECRET_KEY', 'BUCKET', 'gid'), 'gid') ) self.assertEqual(s.load_config(), t)
def test_load_config_attribute_error(self): s = Settings(options=self.default_opts) self.assertEqual(s.load_config(), Settings())
def test_load_config_missing(self): s = Settings( operation=ListOperation('gid', []), options=self._updated_opts({'config': 'tests/resources/test-artifact-cli.conf'})) self.assertEqual(s.load_config(), Settings())