コード例 #1
0
def test_lg_not_supported_option(dummy_site):

    s = dummy_site(lambda x: [x], '2.4.7')
    lp = ListGroups('--owned')

    with pytest.raises(NotImplementedError):
        lp.execute_on(s)
コード例 #2
0
def test_lg_iter(dummy_site):
    '''
    Test that the resulting object from a List Projects command can be
    iterated over successfully.

    A duck-typed Site object is used to return a fixed result.

    '''
    s = dummy_site(lambda _: ['p1', 'p2'], '2.7.0')
    lp = ListGroups()
    r = lp.execute_on(s)
    assert r == ['p1', 'p2']
    for i, p in enumerate(lp):
        assert p == ['p1', 'p2'][i]
コード例 #3
0
def test_lg_not_supported(dummy_site):
    s = dummy_site(lambda x: [x], '2.0.0')
    lp = ListGroups()

    with pytest.raises(NotImplementedError):
        lp.execute_on(s)