def test_client_secret_delete_rotate(self, client, token_generator):
    headers = {'content-type': 'application/json', 'authorization': f'bearer {token_generator.get_token(client)}'}
    user_ids = post_users(USERS, client, token_generator.get_token(client))
    client_ids = self._post_clients(client, user_ids, token_generator)
    client_to_patch = client_ids[0]
    response = client.post('/clients?action=delete_secret', data=json.dumps({'id': client_to_patch}), headers=headers)
    expect(response.status_code).to(equal(200))
    response = client.get('/clients/{}'.format(client_to_patch), headers=headers)
    expect(response.json['response']['client_secret']).to(equal(None))
    response = client.post('/clients?action=rotate_secret', data=json.dumps({'id': client_to_patch}), headers=headers)
    expect(response.status_code).to(equal(200))
    response = client.get('/clients/{}'.format(client_to_patch), headers=headers)
    expect(len(response.json['response']['client_secret'])).to(equal(48))
    self._cleanup(client, token_generator, user_ids=user_ids)
def test_client_secret_delete_rotate(self, client, token_generator):
    headers = {'content-type': 'application/json', 'authorization': f'bearer {token_generator.get_token(client)}'}
    user_ids = post_users(USERS, client, token_generator.get_token(client))
    client_ids = self._post_clients(client, user_ids, token_generator)
    client_to_patch = client_ids[0]
    response = client.post('/clients?action=delete_secret', data=json.dumps({'id': client_to_patch}), headers=headers)
    expect(response.status_code).to(equal(200))
    response = client.get('/clients/{}'.format(client_to_patch), headers=headers)
    expect(response.json['response']['client_secret']).to(equal(None))
    response = client.post('/clients?action=rotate_secret', data=json.dumps({'id': client_to_patch}), headers=headers)
    expect(response.status_code).to(equal(200))
    response = client.get('/clients/{}'.format(client_to_patch), headers=headers)
    expect(len(response.json['response']['client_secret'])).to(equal(48))
    self._cleanup(client, token_generator, user_ids=user_ids)