Esempio n. 1
0
def test_fetch_www_patched_results(monkeypatch, fake_request):
    monkeypatch.setattr(request, 'urlopen', fake_request)

    for td in [
        'test', '🐸', '\n\t', ' ',
        '{\n\t"a": {\n\t\t"b": "c"\n\t}\n}'
    ]:
        with fetch_www(td) as t:
            assert t == td
Esempio n. 2
0
def test_fetch_www_wrong_urls():
    for wu in ['', '2342', '/']:
        with fetch_www(wu) as t:
            assert t is None
Esempio n. 3
0
def test_fetch_www_fallback():
    for wu in ['', '2342', '/']:
        for fb in [None, True, False, 'wrong', {}]:
            with fetch_www(wu, fallback=fb) as t:
                assert t == fb
Esempio n. 4
0
def test_fetch_www_wrong_urls():
    for wu in ['', '2342', '/']:
        with fetch_www(wu) as t:
            assert t is None
Esempio n. 5
0
def test_fetch_www_patched_results(monkeypatch, fake_request):
    monkeypatch.setattr(request, 'urlopen', fake_request)

    for td in ['test', '🐸', '\n\t', ' ', '{\n\t"a": {\n\t\t"b": "c"\n\t}\n}']:
        with fetch_www(td) as t:
            assert t == td
Esempio n. 6
0
def test_fetch_www_fallback():
    for wu in ['', '2342', '/']:
        for fb in [None, True, False, 'wrong', {}]:
            with fetch_www(wu, fallback=fb) as t:
                assert t == fb