def test_validate_password_without_user(self): self.rsrc_defn['Properties']['credentials'].pop('user') jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack) ex = self.assertRaises(exception.StackValidationFailed, jb.validate) error_msg = ('Property error: resources.job-binary.properties.' 'credentials: Property user not assigned') self.assertEqual(error_msg, six.text_type(ex))
def test_validate_invalid_url(self): self.rsrc_defn['Properties']['url'] = 'internal-db://38273f82' jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack) ex = self.assertRaises(exception.StackValidationFailed, jb.validate) error_msg = ('resources.job-binary.properties: internal-db://38273f82 ' 'is not a valid job location.') self.assertEqual(error_msg, six.text_type(ex))
def test_validate_password_without_user(self): props = self.stack.t.t['resources']['job-binary']['properties'].copy() props['credentials'].pop('user') self.rsrc_defn = self.rsrc_defn.freeze(properties=props) jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack) ex = self.assertRaises(exception.StackValidationFailed, jb.validate) error_msg = ('Property error: resources.job-binary.properties.' 'credentials: Property user not assigned') self.assertEqual(error_msg, str(ex))
def test_validate_invalid_url(self): props = self.stack.t.t['resources']['job-binary']['properties'].copy() props['url'] = 'internal-db://38273f82' self.rsrc_defn = self.rsrc_defn.freeze(properties=props) jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack) ex = self.assertRaises(exception.StackValidationFailed, jb.validate) error_msg = ('resources.job-binary.properties: internal-db://38273f82 ' 'is not a valid job location.') self.assertEqual(error_msg, str(ex))
def _create_resource(self, name, snippet, stack): jb = job_binary.JobBinary(name, snippet, stack) value = mock.MagicMock(id='12345') self.client.job_binaries.create.return_value = value scheduler.TaskRunner(jb.create)() return jb