Esempio n. 1
0
def test_shortener_debug_enabled():
    url = 'http://www.test.com'
    small = 'http://small.com'
    responses.add(responses.GET, url, body=small)
    responses.add(responses.GET, small, body=url)

    s = Shortener(debug=True)
    s.short('http://www.test.com')
    s.expand('http://small.com')
    with pytest.raises(NotImplementedError):
        s.total_clicks('http://small.com')
Esempio n. 2
0
def test_shortener_debug_enabled():
    url = 'http://www.test.com'
    small = 'http://small.com'
    responses.add(responses.GET, url, body=small)
    responses.add(responses.GET, small, body=url)

    s = Shortener(debug=True)
    s.short('http://www.test.com')
    s.expand('http://small.com')
    with pytest.raises(NotImplementedError):
        s.total_clicks('http://small.com')
Esempio n. 3
0
def test_base_total_clicks():
    s = Shortener()
    s.shorten = 'http://test.com'
    with pytest.raises(NotImplementedError):
        s.total_clicks()
Esempio n. 4
0
def test_total_clicks_bad_url():
    s = Shortener()

    with pytest.raises(ValueError):
        s.total_clicks('test.com')
Esempio n. 5
0
def test_total_clicks_no_url_or_shorten():
    s = Shortener()

    with pytest.raises(TypeError):
        s.total_clicks()
Esempio n. 6
0
def test_total_clicks_bad_url():
    s = Shortener()

    with pytest.raises(ValueError):
        s.total_clicks('test.com')
Esempio n. 7
0
def test_total_clicks_no_url_or_shorten():
    s = Shortener()

    with pytest.raises(TypeError):
        s.total_clicks()
Esempio n. 8
0
def test_base_total_clicks():
    s = Shortener()
    s.shorten = 'http://test.com'
    with pytest.raises(NotImplementedError):
        s.total_clicks()