def test_find_two_contexts(): repo = get_repo(mock_ui(), 'two_revs') opts = get_initial_opts() contexts = find_contexts(repo, repo['000000'], repo[1], opts) eq_(2, len(contexts))
def test_no_reviewboard_configured(self, mock_create_review): ui = mock_ui() ui.setconfig('reviewboard', 'server', None) repo = get_repo(ui, 'two_revs') opts = get_initial_opts() postreview(ui, repo, **opts)
def test_find_one_context(): repo = get_repo(mock_ui(), 'two_revs') opts = get_initial_opts() contexts = find_contexts(repo, repo[0], repo[1], opts) eq_(1, len(contexts))
def test_browser_launch_default(self, mock_launch, mock_create_method): ui = mock_ui() repo = get_repo(ui, 'two_revs') opts = get_initial_opts() opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) assert mock_launch.called == False
def set_up_two_revs(): ui = mock_ui() repo = get_repo(ui, 'two_revs') opts = get_initial_opts() c = repo[1] parentc = repo['000000'] return ui, repo, c, parentc, opts
def test_outgoing(mock_send): ui = mock_ui() repo = get_repo(ui, 'two_revs') opts = get_initial_opts() opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) expected = open('mercurial_reviewboard/tests/diffs/two_revs_1', 'r').read() eq_(expected, mock_send.call_args[0][4])
def test_browser_launch_false(self, mock_launch, mock_create_method): ui = mock_ui() ui.setconfig('reviewboard', 'launch_webbrowser', 'false') repo = get_repo(ui, 'two_revs') opts = get_initial_opts() opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) assert mock_launch.called == False
def test_not_tip(mock_send): '''Test that the diff is for revision 0.''' ui = mock_ui() repo = get_repo(ui, 'two_revs_clone_not_tip') opts = get_initial_opts() opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) expected = open('mercurial_reviewboard/tests/diffs/two_revs_0', 'r').read() eq_(expected, mock_send.call_args[0][4])
def test_reviewboard_option(self, mock_create_review): ui = mock_ui() ui.setconfig('reviewboard', 'server', None) repo = get_repo(ui, 'two_revs') opts = get_initial_opts() opts['server'] = 'example.com' opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) assert mock_create_review.called
def test_changeset_shown(self, mock_create_method): ui = mock_ui() repo = get_repo(ui, 'two_revs') opts = get_initial_opts() opts['parent'] = '000000' opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) eq_(self.expected_status, ui.status.call_args_list[1][0][0])
def test_remoteparent_is_empty(): ui = mock_ui() child_repo_path = '%s/no_revs' % repos_dir repo = get_repo(ui, 'two_revs') parent = remoteparent(ui, repo, repo.changectx(1), upstream=child_repo_path) eq_('0000000000000000000000000000000000000000', parent.hex())
def test_browser_launch_true(self, mock_launch, mock_create_method): mock_create_method.return_value = '1' ui = mock_ui() ui.setconfig('reviewboard', 'launch_webbrowser', 'true') repo = get_repo(ui, 'two_revs') opts = get_initial_opts() opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) eq_('http://example.com/r/1/', mock_launch.call_args[0][1])
def test_branch_description(): ui = mock_ui() repo = get_repo(ui, 'branch') opts = get_initial_opts() opts['branch'] = True c = repo[4] parentc = repo[0] fields = createfields(ui, repo, c, parentc, opts) expected = ('review of branch: the_branch\n\n' 'changesets:\n' '\t4:173fa0623445 "4"\n' '\t3:0c15fa2e6ba5 "3"\n') eq_(expected, fields['description'])
def test_changeset_on_branch(self, mock_create_method): """in branch mode only show revisions on branch""" expected_status = \ 'review of branch: default\n\n'\ 'changesets:\n\t5:1de20dbad49b "5"'\ '\n\t2:e97ab41d91c8 "2"'\ '\n\t1:7051d9f99104 "1"\n\t0:1d4da73b2570 "0"\n\n' ui = mock_ui() repo = get_repo(ui, 'merge') opts = get_initial_opts() opts['branch'] = True opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) eq_(expected_status, ui.status.call_args_list[1][0][0])
def test_changeset_shown(self, mock_create_method): """status should show all revisions on all included branches""" expected_status = \ 'changesets:\n\t5:1de20dbad49b "5"'\ '\n\t4:d955e65420c8 "4"\n\t3:13a89135f389 "3"'\ '\n\t2:e97ab41d91c8 "2"'\ '\n\t1:7051d9f99104 "1"\n\t0:1d4da73b2570 "0"\n\n' ui = mock_ui() repo = get_repo(ui, 'merge') opts = get_initial_opts() opts['parent'] = '000000' opts['outgoingchanges'] = False opts['outgoing'] = False postreview(ui, repo, **opts) eq_(expected_status, ui.status.call_args_list[1][0][0])