Esempio n. 1
0
def test_lp_not_supported_option(dummy_site):

    s = dummy_site(lambda x: [x], '2.4.7')
    lp = ProjectList('-d')

    with pytest.raises(NotImplementedError):
        lp.execute_on(s)
Esempio n. 2
0
def test_lp_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 = ProjectList()
    r = lp.execute_on(s)
    assert r == ['p1', 'p2']
    for i, p in enumerate(lp):
        assert p == ['p1', 'p2'][i]