Example #1
0
def test_bbforks_no_forks(monkeypatch, ui):
    list_forks = Mock(return_value=None)
    incoming = Mock(name='incoming', spec=commands.incoming)
    reponame = Mock(return_value = [])
    monkeypatch.setattr(hgbb, 'list_forks', list_forks)
    monkeypatch.setattr(hgbb, 'get_bbreponame', reponame)
    monkeypatch.setattr(commands, 'incoming', incoming)
    hgbb.bb_forks(ui, None)
    hgbb.bb_forks(ui, None, incoming=True)

    assert not incoming.called
Example #2
0
def test_bbforks_no_forks(monkeypatch, ui):
    list_forks = Mock(return_value=None)
    incoming = Mock(name='incoming', spec=commands.incoming)
    reponame = Mock(return_value = [])
    monkeypatch.setattr(hgbb, 'list_forks', list_forks)
    monkeypatch.setattr(hgbb, 'get_bbreponame', reponame)
    monkeypatch.setattr(commands, 'incoming', incoming)
    hgbb.bb_forks(ui, None)
    hgbb.bb_forks(ui, None, incoming=True)

    assert not incoming.called
Example #3
0
def test_bbforks_some_forks(monkeypatch, ui):
    def configlist(section, key):
        if key=='ignore_forks':
            return ['some']
    ui.configlist.side_effect = configlist
    ui.popbuffer.return_value = '\xff'

    list_forks = Mock(return_value=['some', 'other', 'moar'])
    incoming = Mock(name='incoming', spec=commands.incoming)
    reponame = Mock(return_value=[])
    monkeypatch.setattr(hgbb, 'list_forks', list_forks)
    monkeypatch.setattr(hgbb, 'get_bbreponame', reponame)
    monkeypatch.setattr(commands, 'incoming', incoming)

    hgbb.bb_forks(ui, None)
    hgbb.bb_forks(ui, None, incoming=True)

    assert incoming.call_count==2
Example #4
0
def test_bbforks_some_forks(monkeypatch, ui):
    def configlist(section, key):
        if key=='ignore_forks':
            return ['some']
    ui.configlist.side_effect = configlist
    ui.popbuffer.return_value = '\xff'

    list_forks = Mock(return_value=['some', 'other', 'moar'])
    incoming = Mock(name='incoming', spec=commands.incoming)
    reponame = Mock(return_value=[])
    monkeypatch.setattr(hgbb, 'list_forks', list_forks)
    monkeypatch.setattr(hgbb, 'get_bbreponame', reponame)
    monkeypatch.setattr(commands, 'incoming', incoming)

    hgbb.bb_forks(ui, None)
    hgbb.bb_forks(ui, None, incoming=True)

    assert incoming.call_count==2