本文整理汇总了Python中plainbox.impl.job.JobDefinition类的典型用法代码示例。如果您正苦于以下问题:Python JobDefinition类的具体用法?Python JobDefinition怎么用?Python JobDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JobDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_translated_data__None_msgid
def test_get_translated_data__None_msgid(self):
"""
Verify the runtime behavior of get_translated_data()
"""
job = JobDefinition(self._full_record.data)
with mock.patch.object(job, "_provider"):
self.assertEqual(job.get_translated_data(None), None)
示例2: test_get_translated_data__no_provider
def test_get_translated_data__no_provider(self):
"""
Verify the runtime behavior of get_translated_data()
"""
job = JobDefinition(self._full_record.data)
job._provider = None
self.assertEqual(job.get_translated_data('foo'), 'foo')
示例3: test_via_does_not_change_checksum
def test_via_does_not_change_checksum(self):
"""
verify that the 'via' attribute in no way influences job checksum
"""
# Create a 'parent' job
parent = JobDefinition({'name': 'parent', 'plugin': 'local'})
# Create a 'child' job, using create_child_job_from_record() should
# time the two so that child.via should be parent.checksum.
#
# The elaborate record that gets passed has all the meta-data that
# traces back to the 'parent' job (as well as some imaginary line_start
# and line_end values for the purpose of the test).
child = parent.create_child_job_from_record(
RFC822Record(
data={'name': 'test', 'plugin': 'shell'},
origin=Origin(
source=JobOutputTextSource(parent),
line_start=1,
line_end=1)))
# Now 'child.via' should be the same as 'parent.checksum'
self.assertEqual(child.via, parent.checksum)
# Create an unrelated job 'helper' with the definition identical as
# 'child' but without any ties to the 'parent' job
helper = JobDefinition({'name': 'test', 'plugin': 'shell'})
# And again, child.checksum should be the same as helper.checksum
self.assertEqual(child.checksum, helper.checksum)
示例4: test_dependency_parsing_empty
def test_dependency_parsing_empty(self):
job = JobDefinition({
'id': 'id',
'plugin': 'plugin'})
expected = set()
observed = job.get_direct_dependencies()
self.assertEqual(expected, observed)
示例5: test_via_does_not_change_checksum
def test_via_does_not_change_checksum(self):
parent = JobDefinition({'name': 'parent', 'plugin': 'local'})
child = parent.create_child_job_from_record(
RFC822Record({'name': 'test', 'plugin': 'shell'}, None))
helper = JobDefinition({'name': 'test', 'plugin': 'shell'})
self.assertEqual(child.via, parent.get_checksum())
self.assertEqual(child.get_checksum(), helper.get_checksum())
示例6: test_environ_parsing_empty
def test_environ_parsing_empty(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin'})
expected = set()
observed = job.get_environ_settings()
self.assertEqual(expected, observed)
示例7: test_resource_parsing_empty
def test_resource_parsing_empty(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin'})
expected = set()
observed = job.get_resource_dependencies()
self.assertEqual(expected, observed)
示例8: test_tr_summary__falls_back_to_id
def test_tr_summary__falls_back_to_id(self):
"""
Verify that Provider1.tr_summary() falls back to job.id, if summary is
not defined
"""
job = JobDefinition({'id': 'id'})
self.assertEqual(job.tr_summary(), 'id')
示例9: test_dependency_parsing_single_word
def test_dependency_parsing_single_word(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin',
'depends': 'word'})
expected = set(['word'])
observed = job.get_direct_dependencies()
self.assertEqual(expected, observed)
示例10: test_environ_parsing_single_word
def test_environ_parsing_single_word(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin',
'environ': 'word'})
expected = set(['word'])
observed = job.get_environ_settings()
self.assertEqual(expected, observed)
示例11: test_resource_parsing_typical
def test_resource_parsing_typical(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin',
'requires': 'foo.bar == 10'})
expected = set(['foo'])
observed = job.get_resource_dependencies()
self.assertEqual(expected, observed)
示例12: test_depedency_parsing_multiple_commas
def test_depedency_parsing_multiple_commas(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin',
'depends': 'foo,,,,bar'})
expected = set({'foo', 'bar'})
observed = job.get_direct_dependencies()
self.assertEqual(expected, observed)
示例13: test_depedency_parsing_newlines
def test_depedency_parsing_newlines(self):
job = JobDefinition({
'name': 'name',
'plugin': 'plugin',
'depends': 'foo\nbar\nfroz'})
expected = set({'foo', 'bar', 'froz'})
observed = job.get_direct_dependencies()
self.assertEqual(expected, observed)
示例14: test_get_translated_data__typical
def test_get_translated_data__typical(self):
"""
Verify the runtime behavior of get_translated_data()
"""
job = JobDefinition(self._full_record.data)
with mock.patch.object(job, "_provider") as mock_provider:
retval = job.get_translated_data('foo')
mock_provider.get_translated_data.assert_called_with("foo")
self.assertEqual(retval, mock_provider.get_translated_data())
示例15: test_environ_parsing_with_various_separators
def test_environ_parsing_with_various_separators(self):
job = JobDefinition({
'id': 'id',
'plugin': 'plugin',
'environ': self.parameters_keymap[
self.parameters.glue].join(['foo', 'bar', 'froz'])})
expected = set({'foo', 'bar', 'froz'})
observed = job.get_environ_settings()
self.assertEqual(expected, observed)