Esempio 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)
Esempio n. 2
0
def instance():
    c = client.Yourls(tests.sharevar.standard_url, key="12345")
    yield c
    tests.sharevar.modifier = None
Esempio n. 3
0
def test_i_url_exists():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("")
Esempio 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
Esempio n. 5
0
def test_i_user_agent():
    inst = client.Yourls("http://example.com", key="1234")
    assert "user-agent" in inst.session.headers.update
Esempio n. 6
0
def test_i_api_key():
    client.Yourls("http://example.com", key="123456789")
Esempio n. 7
0
def test_i_user_passwd():
    client.Yourls("http://example.com", user="******", passwd="password")
Esempio n. 8
0
def test_i_credentials_present():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("http://example.com")
Esempio 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"
Esempio n. 10
0
def test_i_url_schema():
    with pytest.raises(exceptions.Pyourls3ParamError):
        client.Yourls("example.com")