Esempio n. 1
0
def test_api_key_is_valid_ignore_all():
    origin = None
    referrer = None
    domains = list()
    expiration_date = None

    assert api_key_is_valid(domains, expiration_date, origin, referrer)
Esempio n. 2
0
def test_api_key_is_valid_ignore_date():
    origin = "wwww.globalforestwatch.org"
    domains = GOOD_DOMAINS
    expiration_date = None

    assert api_key_is_valid(domains, expiration_date, origin)
Esempio n. 3
0
def test_api_key_is_valid_bad_date():
    origin = "wwww.globalforestwatch.org"
    domains = GOOD_DOMAINS
    expiration_date = datetime.now() - timedelta(1000)

    assert not api_key_is_valid(domains, expiration_date, origin)
Esempio n. 4
0
def test_api_key_is_valid_ignore_referrers(referrer):
    domains = list()
    expiration_date = datetime.now() + timedelta(1000)

    assert api_key_is_valid(domains, expiration_date, referrer=referrer)
Esempio n. 5
0
def test_api_key_is_valid_bad_referrers(referrer):
    domains = GOOD_DOMAINS
    expiration_date = datetime.now() + timedelta(1000)

    assert not api_key_is_valid(domains, expiration_date, referrer=referrer)
Esempio n. 6
0
def test_api_key_is_valid_ignore_origin(origin):
    domains = list()
    expiration_date = datetime.now() + timedelta(1000)

    assert api_key_is_valid(domains, expiration_date, origin)
Esempio n. 7
0
def test_api_key_is_valid_bad_origin(origin):
    domains = GOOD_DOMAINS
    expiration_date = datetime.now() + timedelta(1000)

    assert not api_key_is_valid(domains, expiration_date, origin)