-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
42 lines (29 loc) · 834 Bytes
/
test.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
import time
import handset
import life
def test_rpik():
now = time.time()
tek = handset.TEK(seed_epoch=now)
rpik = handset.RPIK(tek)
now += 6*3600
e = handset.get_enin(now)
check = rpik.get_proximity_id(e)
all_rpis = rpik.enumerate_proximity_ids()
assert check in all_rpis.keys()
def test_contact():
subj = handset.Handset('subj')
other = handset.Handset('other')
now = time.time()
subj.create_tek(now)
other.create_tek(now)
# 6 hours later we interact
now += 6*3600
subj_rpi = subj.get_rpi(now)
other_rpi = other.get_rpi(now)
subj.receive_rpi(other_rpi)
other.receive_rpi(subj_rpi)
# upload subject TEK to the cloud
cloud = life.Cloud()
subj.upload_teks(cloud)
check = other.determine_contacts(cloud)
assert len(check) == 1