Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)