Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest.py
More file actions
Latest commit
66 lines (53 loc) · 1.75 KB
/
Copy pathtest.py
File metadata and controls
66 lines (53 loc) · 1.75 KB
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
66
fromapiimportStreamClient, ObjCode, AtTaskObject
defexample():
client=StreamClient('http://localhost:8080/attask/api')
print'Logging in...'
client.login('admin','user')
print'Done'
print'Retrieving user...'
user=AtTaskObject(client.get(ObjCode.USER,client.user_id,['ID','homeGroupID','emailAddr']))
print'Done'
printuser
print'Searching projects...'
results=client.search(ObjCode.PROJECT,{'groupID':user.homeGroupID})
print'Done'
print'%s project(s) found'%len(results)
forpinresults:
project=AtTaskObject(p)
print' - %s'%project.name
print'Creating project...'
project=AtTaskObject(client.post(ObjCode.PROJECT,{'name':'My Project','groupID':user.homeGroupID}))
print'Done'
printproject
print'Retrieving project...'
project=AtTaskObject(client.get(ObjCode.PROJECT,project.ID))
print'Done'
printproject
print'Editing project...'
project=AtTaskObject(client.put(ObjCode.PROJECT,project.ID,{'ownerID':user.ID}),client)
print'Done'
printproject
print'Deleting project...'
client.delete(ObjCode.PROJECT,project.ID)
print'Done'
print'Creating another project...'
project=AtTaskObject({},client)
project.objCode=ObjCode.PROJECT
project.name='My New Project'
project.groupID=user.homeGroupID
project.save()
print'Done'
printproject
print'Editing another project...'
project.ownerID=user.ID
project.save()
print'Done'
printproject
print'Deleting another project...'
client.delete(ObjCode.PROJECT,project.ID)
print'Done'
print'Logging out...'
client.logout()
print'Done'
if__name__=='__main__':
example()