Beispiel #1
0
    def test_process_main(self, fake_lib):
        path = 'root/path-123'
        repo_id = 'repo-123'

        # test
        step = Clean()
        step.parent = Mock(storage_dir=path, repo_id=repo_id)
        step.process_main()

        # validation
        fake_lib.Repository.assert_called_once_with(path)
        fake_lib.Remote.assert_called_once_with(repo_id, fake_lib.Repository.return_value)
        fake_lib.Remote.return_value.delete.assert_called_once_with()
Beispiel #2
0
    def test_process_main_exception(self, fake_lib):
        path = 'root/path-123'
        importer_id = 'importer-xyz'

        fake_lib.LibError = LibError
        fake_lib.Remote.return_value.delete.side_effect = LibError

        # test
        step = Clean()
        step.parent = Mock(storage_dir=path, importer_id=importer_id)
        with self.assertRaises(PulpCodedException) as assertion:
            step.process_main()
            self.assertEqual(assertion.exception.error_code, errors.OST0003)
Beispiel #3
0
    def test_process_main(self, fake_lib):
        path = 'root/path-123'
        repo_id = 'repo-123'

        # test
        step = Clean()
        step.parent = Mock(storage_dir=path, repo_id=repo_id)
        step.process_main()

        # validation
        fake_lib.Repository.assert_called_once_with(path)
        fake_lib.Remote.assert_called_once_with(
            repo_id, fake_lib.Repository.return_value)
        fake_lib.Remote.return_value.delete.assert_called_once_with()
Beispiel #4
0
    def test_process_main_exception(self, fake_lib):
        path = 'root/path-123'
        importer_id = 'importer-xyz'

        fake_lib.LibError = LibError
        fake_lib.Remote.return_value.delete.side_effect = LibError

        # test
        try:
            step = Clean()
            step.parent = Mock(storage_dir=path, importer_id=importer_id)
            step.process_main()
            self.assertTrue(False, msg='Delete remote exception expected')
        except PulpCodedException, pe:
            self.assertEqual(pe.error_code, errors.OST0003)
Beispiel #5
0
    def test_process_main_exception(self, fake_lib):
        path = 'root/path-123'
        importer_id = 'importer-xyz'

        fake_lib.LibError = LibError
        fake_lib.Remote.return_value.delete.side_effect = LibError

        # test
        try:
            step = Clean()
            step.parent = Mock(storage_dir=path, importer_id=importer_id)
            step.process_main()
            self.assertTrue(False, msg='Delete remote exception expected')
        except PulpCodedException, pe:
            self.assertEqual(pe.error_code, errors.OST0003)