Exemplo n.º 1
0
def test_exception_handling():
    exception = None
    api_call = api.reverse_ip('ss')
    assert api_call.status == 400
    try:
        api_call.data()
    except Exception as e:
        exception = e

    assert exception
    assert exception.code == 400
    assert 'not understand' in exception.reason['error']['message']

    with pytest.raises(exceptions.NotFoundException):
        api._results('i_made_this_product_up',
                     '/v1/steianrstierstnrsiatiarstnsto.com/whois').data()
    with pytest.raises(exceptions.NotAuthorizedException):
        API('notauser', 'notakey').domain_search('amazon').data()
    with pytest.raises(
            ValueError,
            match=
            r"Invalid value 'notahash' for 'key_sign_hash'. Values available are sha1,sha256,md5"
    ):
        API('notauser',
            'notakey',
            always_sign_api_key=True,
            key_sign_hash='notahash').domain_search('amazon')
Exemplo n.º 2
0
def test_exception_handling():
    exception = None
    api_call = api.reverse_ip('ss')
    assert api_call.status == 400
    try:
        api_call.data()
    except Exception as e:
        exception = e

    assert exception
    assert exception.code == 400
    assert 'not understand' in exception.reason['error']['message']

    with pytest.raises(exceptions.NotFoundException):
        api._results('i_made_this_product_up',
                     '/v1/steianrstierstnrsiatiarstnsto.com/whois').data()
    with pytest.raises(exceptions.NotAuthorizedException):
        API('notauser', 'notakey').domain_search('amazon').data()
Exemplo n.º 3
0
def test_reverse_ip():
    with api.reverse_ip('google.com') as results:
        assert 'ip_addresses' in results