forked from vcon-dev/vcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_party_search.py
43 lines (31 loc) · 1.25 KB
/
test_party_search.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
""" Unit test for party search methods """
import pytest
import vcon
def test_party_search():
vCon = vcon.Vcon()
assert(len(vCon.parties) == 0)
vCon.set_party_parameter("tel", "+16171234567")
vCon.set_party_parameter("tel", "+16171111111")
vCon.set_party_parameter("tel", "+16170000000")
vCon.set_party_parameter("tel", "+18571234567")
assert(len(vCon.parties) == 4)
vCon.set_party_parameter("mailto", "[email protected]", 3)
assert(len(vCon.parties) == 4)
vCon.set_party_parameter("mailto", "[email protected]")
vCon.set_party_parameter("mailto", "[email protected]")
vCon.set_party_parameter("mailto", "[email protected]")
assert(len(vCon.parties) == 7)
found = vCon.find_parties_by_parameter("tel", "+1617")
assert(len(found) == 3)
found = vCon.find_parties_by_parameter("tel", "1234567")
assert(len(found) == 2)
found = vCon.find_parties_by_parameter("mailto", "@example.com")
assert(len(found) == 3)
found = vCon.find_parties_by_parameter("mailto", "a@")
assert(len(found) == 2)
found = vCon.find_parties_by_parameter("mailto", "xxx")
assert(len(found) == 0)
found = vCon.find_parties_by_parameter("mailto", "[email protected]")
assert(len(found) == 1)
found = vCon.find_parties_by_parameter("name", "xxx")
assert(len(found) == 0)