def test_revoke_with_tokenhash():

    global token_hash

    token_hash_found = False
    found = None

    r = provider.audit_tokens(5)
    assert r["success"] is True
    audit_report = r['response']
    as_provider = audit_report["as-provider"]

    for a in as_provider:
        if a['token-hash'] == token_hash:
            token_hash_found = True
            found = a
            break

    assert token_hash_found is True
    assert found['revoked'] is False

    r = provider.revoke_token_hashes(token_hash)
    assert r['success'] is True
    assert r["response"]["num-tokens-revoked"] >= 1

    # check if token was revoked
    r = provider.audit_tokens(5)
    assert r["success"] is True
    audit_report = r['response']
    as_provider = audit_report["as-provider"]

    token_hash_found = False
    found = None
    for a in as_provider:
        if a['token-hash'] == token_hash:
            token_hash_found = True
            found = a
            break

    assert token_hash_found is True
    assert found['revoked'] is True
token_hash = hashlib.sha256(token.encode('utf-8')).hexdigest()

token_hash_found = False
found = None

for a in as_provider:
    if a['token-hash'] == token_hash:
        token_hash_found = True
        found = a
        break

assert token_hash_found is True
assert found['revoked'] is False

r = provider.revoke_token_hashes(token_hash)
assert r['success'] is True
assert r["response"]["num-tokens-revoked"] >= 1

# check if token was revoked
r = provider.audit_tokens(5)
assert r["success"] is True
audit_report = r['response']
as_provider = audit_report["as-provider"]

token_hash_found = False
found = None
for a in as_provider:
    if a['token-hash'] == token_hash:
        token_hash_found = True
        found = a
assert num_tokens_after > num_tokens_before

token_hash = hashlib.sha256(token).hexdigest()

token_hash_found = False
found = None

for a in as_provider:
    if a['token-hash'] == token_hash:
        token_hash_found = True
        found = a
        break

assert token_hash_found is True
assert found['revoked'] is False
assert provider.revoke_token_hashes(token_hash)['success'] is True

# check if token was revoked
r = provider.audit_tokens(5)
assert r["success"] is True
audit_report = r['response']
as_provider = audit_report["as-provider"]

token_hash_found = False
found = None
for a in as_provider:
    if a['token-hash'] == token_hash:
        token_hash_found = True
        found = a
        break
Exemple #4
0
assert num_tokens_after > num_tokens_before

token_hash = hashlib.sha256(token).hexdigest()

token_hash_found = False
found = None

for a in as_provider:
	if a['token-hash'] == token_hash:
		token_hash_found = True
		found = a
		break

assert token_hash_found	is True
assert found['revoked'] is False
assert True == provider.revoke_token_hashes(token_hash)['success']

# check if token was revoked
r = provider.audit_tokens(5)
assert r["success"] is True
audit_report = r['response']
as_provider = audit_report["as-provider"]

token_hash_found = False
found = None
for a in as_provider:
	if a['token-hash'] == token_hash:
		token_hash_found = True
		found = a
		break