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