forked from icgc-dcc/Daco2Ego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_daco2ego.py
executable file
·37 lines (30 loc) · 1.16 KB
/
test_daco2ego.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
#!/usr/bin/env python
from daco2ego import get_users, read_config, daco_users_csv_to_list
from daco_user import User
def test_read_config():
expected = {
"client": {
"base_url": "https://ego/v1/",
"dac_api_url": "https://dac-api/v1"
}
}
config = read_config("tests/test.conf")
assert config == expected
def file_to_dict(name):
with open("tests/" + name, "rt") as f:
return daco_users_csv_to_list(f.read())
def test_users():
expected = [
User('[email protected]', 'First Last', True, True),
User('[email protected]', 'Betty White', True, True),
User('[email protected]', 'Betty White', True, True),
User('[email protected]', 'Betty White', True, True),
User('[email protected]', 'Blanche Devereaux', True, True),
User('[email protected]', 'Á woñderful user',
True, True),
User('[email protected]', 'SOME RANDOM GUY',
True, True),
User('[email protected]', 'A Person', True, True)]
users = file_to_dict("test.csv")
print(users)
assert users == expected