-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
38 lines (31 loc) · 1.06 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from admin import C224eAdmin
from user import C224eUser
import signal
import sys
if __name__ == "__main__":
# Create administrator and user object
admin = C224eAdmin()
user = C224eUser()
#Do some magic to make sure we always log out, otherwise we might block the printer
def signal_handler(signal, frame):
admin.logout()
user.logout()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
try:
admin.login('passwort', 'drucker.saw.rwth-aachen.de')
#Let's create some test accounts
admin.createUser('testUser', 'test123')
admin.setLimits('testUser', 111, 222, 'abs')
admin.setLimits('testUser', 9, 8, 'inc')
admin.changePassword('testUser', 'newPassword')
admin.logout()
#And test some user stuff
user.login('testUser', 'newPassword', 'drucker.saw.rwth-aachen.de')
user.getLimits()
user.changePassword('newPassword', 'password')
finally:
admin.logout()
user.logout()