Ejemplo n.º 1
0
    def test_verify_txmbr(self):
        pr = Mock()
        tx = Mock()
        tx.po = 'openssl'
        cb = RPMCallback(pr)

        # test
        cb.verify_txmbr(None, tx, 10)

        # validation
        pr.set_action.assert_called_with('Verifying', tx.po)
Ejemplo n.º 2
0
    def test_errorlog(self):
        pr = ProgressReport()
        pr._updated = Mock()

        # test
        cb = RPMCallback(pr)
        message = 'Something bad happened'
        cb.errorlog(message)

        # validation
        self.assertEqual(pr.details['error'], message)
        self.assertEqual(len(pr.steps), 0)
Ejemplo n.º 3
0
    def test_filelog(self):
        pr = ProgressReport()
        pr._updated = Mock()

        # test and validation
        cb = RPMCallback(pr)
        for action in sorted(cb.fileaction.keys()):
            package = '%s_package' % action
            cb.filelog(package, action)
            self.assertEqual(pr.details['action'], cb.fileaction[action])
            self.assertEqual(pr.details['package'], package)
        self.assertEqual(len(pr.steps), 0)
Ejemplo n.º 4
0
    def test_event(self):
        package = 'openssl'
        pr = Mock()

        # test and validation
        cb = RPMCallback(pr)
        expected_actions = set()
        for action, description in cb.action.items():
            cb.event(package, action)
            cb.event(package, action)  # test 2nd (dup) ignored
            expected_actions.add((package, action))
            self.assertEqual(cb.events, expected_actions)
            pr.set_action.assert_called_with(description, package)
Ejemplo n.º 5
0
    def test_filelog_invalid_action(self):
        pr = ProgressReport()
        pr._updated = Mock()

        # test
        cb = RPMCallback(pr)
        package = 'openssl'
        action = 12345678
        cb.filelog(package, action)

        # validation
        self.assertEqual(pr.details['action'], str(action))
        self.assertEqual(pr.details['package'], package)
        self.assertEqual(len(pr.steps), 0)