Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 1 | import grpc_client |
| 2 | from grpc_client import Empty |
| 3 | from testconfig import * |
| 4 | |
| 5 | c=grpc_client.InsecureClient("xos-core.cord.lab") |
| 6 | |
| 7 | {% for object in proto.messages %} |
| 8 | {%- if object.name!='XOSBase' %} |
| 9 | print "testing insecure List{{ object.name }}...", |
| 10 | c.stub.List{{ object.name }}(Empty()) |
| 11 | print "Okay" |
| 12 | {%- endif %} |
| 13 | {%- endfor %} |
| 14 | |
| 15 | c=grpc_client.SecureClient("xos-core.cord.lab", username=USERNAME, password=PASSWORD) |
| 16 | |
| 17 | {% for object in proto.messages %} |
| 18 | {%- if object.name!='XOSBase' %} |
| 19 | print "testing basic secure List{{ object.name }}...", |
| 20 | c.stub.List{{ object.name }}(Empty()) |
| 21 | print "Okay" |
| 22 | {%- endif %} |
| 23 | {%- endfor %} |
| 24 | |
| 25 | # now try to login |
| 26 | c=grpc_client.InsecureClient("xos-core.cord.lab") |
| 27 | lr=grpc_client.LoginRequest() |
| 28 | lr.username=USERNAME |
| 29 | lr.password=PASSWORD |
| 30 | session=c.utility.Login(lr) |
| 31 | |
| 32 | c=grpc_client.SecureClient("xos-core.cord.lab", sessionid=session.sessionid) |
| 33 | {% for object in proto.messages %} |
| 34 | {%- if object.name!='XOSBase' %} |
| 35 | print "testing session secure List{{ object.name }}...", |
| 36 | c.stub.List{{ object.name }}(Empty()) |
| 37 | print "Okay" |
| 38 | {%- endif %} |
| 39 | {%- endfor %} |
| 40 | |
| 41 | c=grpc_client.SecureClient("xos-core.cord.lab", sessionid=session.sessionid) |
| 42 | {% for object in proto.messages %} |
| 43 | {%- if object.name!='XOSBase' %} |
| 44 | print "testing session secure xos_orm.{{ object.name }}.objects.all() ...", |
| 45 | c.xos_orm.{{ object.name }}.objects.all() |
| 46 | print "Okay" |
| 47 | {%- endif %} |
| 48 | {%- endfor %} |
| 49 | |