def test_validate_password_without_user(self): self.rsrc_defn['Properties']['credentials'].pop('user') ds = data_source.DataSource('data-source', self.rsrc_defn, self.stack) ex = self.assertRaises(exception.StackValidationFailed, ds.validate) error_msg = ('Property error: resources.data-source.properties.' 'credentials: Property user not assigned') self.assertEqual(error_msg, six.text_type(ex))
def test_validate_password_without_user(self): props = self.stack.t.t['resources']['data-source']['properties'].copy() del props['credentials']['user'] self.rsrc_defn = self.rsrc_defn.freeze(properties=props) ds = data_source.DataSource('data-source', self.rsrc_defn, self.stack) ex = self.assertRaises(exception.StackValidationFailed, ds.validate) error_msg = ('Property error: resources.data-source.properties.' 'credentials: Property user not assigned') self.assertEqual(error_msg, six.text_type(ex))
def _create_resource(self, name, snippet, stack): ds = data_source.DataSource(name, snippet, stack) value = mock.MagicMock(id='12345') self.client.data_sources.create.return_value = value scheduler.TaskRunner(ds.create)() return ds