Ejemplo n.º 1
0
def test_i_credential_format():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("http://example.com", key=123456789)
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("http://example.com", user="******", passwd=12345)
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("http://example.com", user=12345)
Ejemplo n.º 2
0
def instance():
    c = client.Yourls(tests.sharevar.standard_url, key="12345")
    yield c
    tests.sharevar.modifier = None
Ejemplo n.º 3
0
def test_i_url_exists():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("")
Ejemplo n.º 4
0
def test_i_creds_correct():
    tests.sharevar.modifier = "badauth"
    with pytest.raises(exceptions.Pyourls3APIError):
        client.Yourls(tests.sharevar.standard_url, key="12345")
    tests.sharevar.modifier = None
Ejemplo n.º 5
0
def test_i_user_agent():
    inst = client.Yourls("http://example.com", key="1234")
    assert "user-agent" in inst.session.headers.update
Ejemplo n.º 6
0
def test_i_api_key():
    client.Yourls("http://example.com", key="123456789")
Ejemplo n.º 7
0
def test_i_user_passwd():
    client.Yourls("http://example.com", user="******", passwd="password")
Ejemplo n.º 8
0
def test_i_credentials_present():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("http://example.com")
Ejemplo n.º 9
0
def test_i_url_formatting():
    url = "https://example.com"
    c = client.Yourls(url, key="12345")
    assert c.api_endpoint != url + "yourls-api.php"
    assert c.api_endpoint == url + "/yourls-api.php"
Ejemplo n.º 10
0
def test_i_url_schema():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("example.com")