Exemplo n.º 1
0
    def _test_sync_with_auto_publish(self):
        """
        Tests that the autodistribute call is properly called at the tail end
        of a successful sync.
        """

        # Setup
        manager_factory.register_manager(manager_factory.TYPE_REPO_PUBLISH, MockRepoPublishManager)

        self.repo_manager.create_repo('repo')
        self.importer_manager.set_importer('repo', 'mock-importer', {})

        # Test
        self.sync_manager.sync('repo')

        # Verify
        self.assertEqual('repo', MockRepoPublishManager.repo_id)
        self.assertEqual({}, MockRepoPublishManager.base_progress_report)
Exemplo n.º 2
0
    def _test_sync_with_auto_publish(self):
        """
        Tests that the autodistribute call is properly called at the tail end
        of a successful sync.
        """

        # Setup
        manager_factory.register_manager(manager_factory.TYPE_REPO_PUBLISH, MockRepoPublishManager)

        self.repo_manager.create_repo('repo')
        self.importer_manager.set_importer('repo', 'mock-importer', {})

        # Test
        self.sync_manager.sync('repo')

        # Verify
        self.assertEqual('repo', MockRepoPublishManager.repo_id)
        self.assertEqual({}, MockRepoPublishManager.base_progress_report)
Exemplo n.º 3
0
    def _test_sync_with_auto_publish_error(self):
        """
        Tests that the autodistribute exception is propagated when one or more auto publish calls fail.
        """

        # Setup
        manager_factory.register_manager(manager_factory.TYPE_REPO_PUBLISH, MockRepoPublishManager)
        MockRepoPublishManager.raise_error = True

        self.repo_manager.create_repo('doa')
        self.importer_manager.set_importer('doa', 'mock-importer', {})

        # Test
        try:
            self.sync_manager.sync('doa')
            self.fail('Expected exception not thrown')
        except repo_publish_manager.PulpExecutionException, e:
            #self.assertTrue('doa' in e)
            pass
Exemplo n.º 4
0
    def _test_sync_with_auto_publish_error(self):
        """
        Tests that the autodistribute exception is propagated when one or more auto publish calls fail.
        """

        # Setup
        manager_factory.register_manager(manager_factory.TYPE_REPO_PUBLISH,
                                         MockRepoPublishManager)
        MockRepoPublishManager.raise_error = True

        self.repo_manager.create_repo('doa')
        self.importer_manager.set_importer('doa', 'mock-importer', {})

        # Test
        try:
            self.sync_manager.sync('doa')
            self.fail('Expected exception not thrown')
        except repo_publish_manager.PulpExecutionException, e:
            #self.assertTrue('doa' in e)
            pass
Exemplo n.º 5
0
    def test_register_and_reset(self):
        """
        Tests that registering a new class and resetting properly affects the
        class mappings.
        """

        # Setup
        class FakeManager:
            pass

        factory.register_manager(factory.TYPE_REPO, FakeManager)

        # Test Register
        manager = factory.get_manager(factory.TYPE_REPO)
        self.assertTrue(isinstance(manager, FakeManager))

        # Test Reset
        factory.reset()
        manager = factory.get_manager(factory.TYPE_REPO)
        self.assertTrue(isinstance(manager, RepoManager))
Exemplo n.º 6
0
    def test_register_and_reset(self):
        """
        Tests that registering a new class and resetting properly affects the
        class mappings.
        """

        # Setup
        class FakeManager:
            pass

        factory.register_manager(factory.TYPE_REPO, FakeManager)

        # Test Register
        manager = factory.get_manager(factory.TYPE_REPO)
        self.assertTrue(isinstance(manager, FakeManager))

        # Test Reset
        factory.reset()
        manager = factory.get_manager(factory.TYPE_REPO)
        self.assertTrue(isinstance(manager, RepoManager))