Example #1
0
    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_no_parent_combo():
    "You cannot have more than one parent revision."
    
    opts = get_initial_opts()
    opts['parent'] = 1
    opts['outgoingchanges'] = True
    postreview(mock_ui(), None, **opts)
Example #3
0
    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
Example #4
0
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])
Example #5
0
    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
Example #6
0
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])
Example #7
0
    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
Example #8
0
    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])
Example #9
0
    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])
Example #10
0
    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])
Example #11
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])