コード例 #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)
コード例 #2
0
ファイル: test_steps.py プロジェクト: daviddavis/pulp_ostree
 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)
コード例 #3
0
ファイル: test_steps.py プロジェクト: bmbouter/pulp_ostree
 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)
コード例 #4
0
ファイル: test_steps.py プロジェクト: jeremycline/pulp_ostree
    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)
コード例 #5
0
ファイル: test_steps.py プロジェクト: bmbouter/pulp_ostree
    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]), {}),
            ])
コード例 #6
0
ファイル: test_steps.py プロジェクト: bmbouter/pulp_ostree
    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%')
コード例 #7
0
ファイル: test_steps.py プロジェクト: bowlofeggs/pulp_ostree
    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%')
コード例 #8
0
ファイル: test_steps.py プロジェクト: bowlofeggs/pulp_ostree
    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)
コード例 #9
0
ファイル: test_steps.py プロジェクト: pombreda/pulp_ostree
    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]), {}),
        ])
コード例 #10
0
ファイル: test_steps.py プロジェクト: daviddavis/pulp_ostree
 def test_init(self):
     step = Pull()
     self.assertEqual(step.step_id, constants.IMPORT_STEP_PULL)
     self.assertTrue(step.description is not None)