def test_change_user_password(event_loop):
async with base.CleanController() as controller:
username = 'test-password{}'.format(uuid.uuid4())
user = await controller.add_user(username)
await user.set_password('password')
# Check that we can connect with the new password.
new_connection = None
try:
kwargs = controller.connection().connect_params()
kwargs['username'] = username
kwargs['password'] = 'password'
new_connection = await Connection.connect(**kwargs)
except JujuAPIError:
raise AssertionError('Unable to connect with new password')
finally:
if new_connection:
await new_connection.close()
评论列表
文章目录