63 |
63 |
assert call.caller == '0612345678'
|
64 |
64 |
assert call.end_timestamp is None
|
65 |
65 |
assert call.details == {}
|
66 |
|
json_start = resp.json['data']['start']
|
67 |
|
start = call.start_timestamp
|
68 |
|
|
69 |
|
# same call, do nothing
|
70 |
|
resp = app.get(
|
71 |
|
start_endpoint, status=200, params={'apikey': '123', 'callee': '42', 'caller': '0612345678'}
|
72 |
|
)
|
73 |
|
assert resp.json['err'] == 0
|
74 |
|
assert resp.json['data']['callee'] == '42'
|
75 |
|
assert resp.json['data']['caller'] == '0612345678'
|
76 |
|
assert resp.json['data']['start'] == json_start
|
77 |
|
assert resp.json['data']['end'] is None
|
78 |
|
assert resp.json['data']['is_current'] is True
|
79 |
|
assert Call.objects.count() == 1
|
80 |
|
call = Call.objects.first()
|
81 |
|
assert call.callee == '42'
|
82 |
|
assert call.caller == '0612345678'
|
83 |
|
assert call.end_timestamp is None
|
84 |
|
assert call.start_timestamp == start
|
85 |
|
assert call.details == {}
|
86 |
|
resp = app.get(
|
87 |
|
start_endpoint,
|
88 |
|
status=200,
|
89 |
|
params={'apikey': '123', 'callee': '42', 'caller': '0612345678', 'foo': 'bar'},
|
90 |
|
) # add details
|
91 |
|
assert resp.json['err'] == 0
|
92 |
|
assert resp.json['data']['callee'] == '42'
|
93 |
|
assert resp.json['data']['caller'] == '0612345678'
|
94 |
|
assert resp.json['data']['start'] == json_start
|
95 |
|
assert resp.json['data']['end'] is None
|
96 |
|
assert resp.json['data']['is_current'] is True
|
97 |
|
assert resp.json['data']['details'] == {'foo': 'bar'}
|
98 |
|
assert Call.objects.count() == 1
|
99 |
|
call = Call.objects.first()
|
100 |
|
assert call.callee == '42'
|
101 |
|
assert call.caller == '0612345678'
|
102 |
|
assert call.end_timestamp is None
|
103 |
|
assert call.start_timestamp == start
|
104 |
|
assert call.details == {'foo': 'bar'}
|
105 |
66 |
|
106 |
67 |
resp = app.get(calls_endpoint, status=200, params={'apikey': '123'})
|
107 |
68 |
assert resp.json['err'] == 0
|
108 |
|
-
|