def revoke_few_tokens(): master_token = create_token() url = KEYSTONE_URL + 'auth/tokens' for i in range(100): headers = {'content-type': 'application/json', 'X-Auth-Token': master_token, 'X-Subject-Token': create_token()} r = requests.delete(url, headers=headers)
from conf import * import requests from token_create import create_token from measure import run def get_user(token): KEYSTONE_URL='http://172.31.10.11:5000/v3/' url = KEYSTONE_URL + 'users/cbb082c086c44138ba55e5b05aebec85' headers = {'content-type': 'application/json', 'X-Auth-Token': token} r = requests.get(url, headers=headers) def revoke_few_tokens(): master_token = create_token() url = KEYSTONE_URL + 'auth/tokens' for i in range(100): headers = {'content-type': 'application/json', 'X-Auth-Token': master_token, 'X-Subject-Token': create_token()} r = requests.delete(url, headers=headers) @run def test(token): get_user(token) if __name__=='__main__': for i in range(1): test(create_token()) #revoke_few_tokens()