mirror of
https://gitlab.com/fabinfra/fabaccess/pyfabapi.git
synced 2025-03-12 14:51:42 +01:00
remove test.py
This commit is contained in:
parent
69c22e91ae
commit
5828b840f0
27
test.py
27
test.py
@ -1,27 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
import fabapi
|
|
||||||
import fabapi.user_system
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
session = await fabapi.connect("localhost", 59661, "Testuser", "secret")
|
|
||||||
info = session.machineSystem.info
|
|
||||||
ma = await info.getMachineURN("urn:fabaccess:resource:Another").a_wait()
|
|
||||||
print(ma)
|
|
||||||
|
|
||||||
# Add an user with the given roles
|
|
||||||
roles = [
|
|
||||||
"somerole", "testrole"
|
|
||||||
]
|
|
||||||
user = await fabapi.user_system.add_user(session.userSystem, "ANewUser", "ANewSecret", roles=roles)
|
|
||||||
print("ANewUser obj: ", user)
|
|
||||||
|
|
||||||
# As you can see, Roles were attached
|
|
||||||
r = await user.info.listRoles().a_wait()
|
|
||||||
print("ANewUser roles: ", r)
|
|
||||||
|
|
||||||
# Delete the same user again
|
|
||||||
await fabapi.user_system.del_user(session.userSystem, "ANewUser")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
loop = asyncio.get_event_loop()
|
|
||||||
loop.run_until_complete(main())
|
|
Loading…
x
Reference in New Issue
Block a user