Пример #1
0
 def test_add_child(self):
     step = publish_step.Step('foo')
     step2 = publish_step.Step('step2')
     step3 = publish_step.Step('step3')
     step.add_child(step2)
     step.add_child(step3)
     self.assertEquals(step.children, [step2, step3])
Пример #2
0
 def test_report_progress_disable_reporting(self):
     """
     Test that we can disable reporting when calling report_progress()
     """
     step = publish_step.Step('foo_step', disable_reporting=True)
     step.status_conduit = Mock()
     step.report_progress()
     self.assertFalse(step.status_conduit.report_progress.called)
Пример #3
0
    def test_progress_overflow_prevention(self):
        step = publish_step.Step('foo_step', disable_reporting=True)
        # ensure the step still defaults to 1
        self.assertEqual(step.get_total(), 1)
        step.progress_successes = 1

        step._process_block()

        # make sure progress does not get incremented beyond the total
        self.assertEqual(step.progress_successes, 1)
Пример #4
0
    def test_increments_progress(self):
        step = publish_step.Step('foo_step', disable_reporting=True)

        step._process_block()

        self.assertEqual(step.progress_successes, 1)
Пример #5
0
 def test__get_total(self):
     step = publish_step.Step('foo_step')
     step.get_total = Mock(return_value=3)
     self.assertEquals(3, step._get_total())
Пример #6
0
 def test_get_total(self):
     step = publish_step.Step('foo_step')
     self.assertEquals(1, step.get_total())
Пример #7
0
 def test_get_status_conduit_from_parent(self):
     step = publish_step.Step('foo_step')
     step.parent = Mock()
     step.parent.get_status_conduit.return_value = 'foo'
     self.assertEquals('foo', step.get_status_conduit())
Пример #8
0
 def test_get_status_conduit(self):
     step = publish_step.Step('foo_step')
     step.status_conduit = 'foo'
     self.assertEquals('foo', step.get_status_conduit())