Exemplo n.º 1
0
 def test_pull_raising_exception(self, fake_lib):
     fake_lib.LibError = LibError
     fake_lib.Repository.return_value.pull.side_effect = LibError
     step = Pull()
     with self.assertRaises(PulpCodedException) as assertion:
         step._pull('', '', '', 0)
         self.assertEqual(assertion.exception.error_code, errors.OST0002)
Exemplo n.º 2
0
 def test_pull_raising_exception(self, fake_lib):
     fake_lib.LibError = LibError
     fake_lib.Repository.return_value.pull.side_effect = LibError
     try:
         step = Pull()
         step._pull('', '', '', 0)
         self.assertTrue(False, msg='Pull exception expected')
     except PulpCodedException, pe:
         self.assertEqual(pe.error_code, errors.OST0002)
Exemplo n.º 3
0
 def test_pull_raising_exception(self, fake_lib):
     fake_lib.LibError = LibError
     fake_lib.Repository.return_value.pull.side_effect = LibError
     try:
         step = Pull()
         step._pull('', '', '')
         self.assertTrue(False, msg='Pull exception expected')
     except PulpCodedException, pe:
         self.assertEqual(pe.error_code, errors.OST0002)
Exemplo n.º 4
0
    def test_process_main(self):
        repo_id = 'repo-xyz'
        path = 'root/path-123'
        branches = ['branch-1', 'branch-2']

        # test
        step = Pull()
        step.parent = Mock(storage_dir=path, repo_id=repo_id, branches=branches)
        step._pull = Mock()
        step.process_main()

        # validation
        step._pull.assert_called_once_with(path, repo_id, branches)
Exemplo n.º 5
0
    def test_pull(self, fake_lib):
        remote_id = 'remote-123'
        path = 'root/path-123'
        branch = 'branch-1'
        repo = Mock()
        fake_lib.Repository.return_value = repo
        report = Mock(fetched=1, requested=2, percent=50)

        def fake_pull(remote_id, branch, listener):
            listener(report)

        repo.pull.side_effect = fake_pull

        # test
        step = Pull()
        step.report_progress = Mock()
        step._pull(path, remote_id, branch)

        # validation
        fake_lib.Repository.assert_called_once_with(path)
        repo.pull.assert_called_once_with(remote_id, [branch], ANY)
        step.report_progress.assert_called_with(force=True)
        self.assertEqual(step.progress_details, 'branch: branch-1 fetching 1/2 50%')
Exemplo n.º 6
0
    def test_pull(self, fake_lib):
        remote_id = 'remote-123'
        path = 'root/path-123'
        branches = ['branch-1']
        repo = Mock()
        fake_lib.Repository.return_value = repo
        report = Mock(fetched=1, requested=2, percent=50)

        def fake_pull(remote_id, branch, listener):
            listener(report)

        repo.pull.side_effect = fake_pull

        # test
        step = Pull()
        step.report_progress = Mock()
        step._pull(path, remote_id, branches)

        # validation
        fake_lib.Repository.assert_called_once_with(path)
        repo.pull.assert_called_once_with(remote_id, branches, ANY)
        step.report_progress.assert_called_with(force=True)
        self.assertEqual(step.progress_details, 'fetching 1/2 50%')
Exemplo n.º 7
0
    def test_process_main(self):
        repo_id = 'repo-xyz'
        path = 'root/path-123'
        branches = ['branch-1', 'branch-2']

        # test
        step = Pull()
        step.parent = Mock(storage_dir=path,
                           repo_id=repo_id,
                           branches=branches)
        step._pull = Mock()
        step.process_main()

        # validation
        step._pull.assert_called_once_with(path, repo_id, branches)
Exemplo n.º 8
0
    def test_process_main(self):
        remote_id = 'remote-123'
        path = 'root/path-123'
        branches = ['branch-1', 'branch-2']

        # test
        step = Pull()
        step.parent = Mock(storage_path=path, remote_id=remote_id, branches=branches)
        step._pull = Mock()
        step.process_main()

        # validation
        self.assertEqual(
            step._pull.call_args_list,
            [
                ((path, remote_id, branches[0]), {}),
                ((path, remote_id, branches[1]), {}),
            ])
Exemplo n.º 9
0
    def test_process_main(self):
        remote_id = 'remote-123'
        path = 'root/path-123'
        branches = ['branch-1', 'branch-2']

        # test
        step = Pull()
        step.parent = Mock(storage_path=path,
                           remote_id=remote_id,
                           branches=branches)
        step._pull = Mock()
        step.process_main()

        # validation
        self.assertEqual(step._pull.call_args_list, [
            ((path, remote_id, branches[0]), {}),
            ((path, remote_id, branches[1]), {}),
        ])