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')
def test_base_total_clicks(): s = Shortener() s.shorten = 'http://test.com' with pytest.raises(NotImplementedError): s.total_clicks()
def test_total_clicks_bad_url(): s = Shortener() with pytest.raises(ValueError): s.total_clicks('test.com')
def test_total_clicks_no_url_or_shorten(): s = Shortener() with pytest.raises(TypeError): s.total_clicks()