-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-module.py
executable file
·67 lines (53 loc) · 1.52 KB
/
test-module.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
import sys
import os
import pprint
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/modules')
from restya.restya import Restyaboard
pp = pprint.PrettyPrinter(indent=2)
restya = Restyaboard({
'username': 'admin',
'password': 'restya',
'server': 'centos-docker',
'port': 1234,
})
print(restya.access_token)
restya.login('[email protected]', 'restya')
print(restya.user_access_token)
print()
restya.get_all()
# print(restya)
for o in restya.organizations:
print('Organization: %s' % (o))
for b in o.org_boards:
print('Board: %s' % (b))
for l in b.board_lists:
print('List: %s' % (l))
sys.exit(0)
# Create an organization
print("add_organization")
org = restya.add_organization('Linux Patching 04/02/2017')
if org is not None:
print("%d:%s" % (org.id, org.name))
else:
print('Organization\'s (%s) name already taken' % ('Linux Patching 04/02/2017'))
print()
# Delete an organization
print("delete_organization")
restya.delete_organization(9)
print()
# Get all organizations
print("get_all_organization")
organizations = restya.get_all_organizations()
for org in organizations:
print("%d:%s" % (org.id, org.name))
print('End get_all_organization')
print()
# Get details about one organization
print("get_organization by id")
org = restya.get_organization({'id': 3})
print("%d:%s" % (org.id, org.name))
print()
print("get_organization by name")
org = restya.get_organization({'name': 'Linux Patching 04/02/2017'})
print("%d:%s" % (org.id, org.name))