Ejemplo 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')
Ejemplo 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')
Ejemplo n.º 3
0
def test_base_total_clicks():
    s = Shortener()
    s.shorten = 'http://test.com'
    with pytest.raises(NotImplementedError):
        s.total_clicks()
Ejemplo n.º 4
0
def test_total_clicks_bad_url():
    s = Shortener()

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

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

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

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