Skip to content

Commit 3920c48

Browse files
committed
(test) unit test
1 parent e3e986a commit 3920c48

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/unit_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import json
2+
from server import loadClubs, app
3+
4+
5+
def test_loadClubs(tmpdir):
6+
clubs = [
7+
{"name": "Club1", "email": "club1@example.com", "points": "10"},
8+
{"name": "Club2", "email": "club2@example.com", "points": "20"},
9+
]
10+
clubs_file = tmpdir.join("test_clubs.json")
11+
with open(clubs_file, "w") as f:
12+
json.dump({"clubs": clubs}, f)
13+
14+
app.config["CLUBS_FILE"] = str(clubs_file)
15+
16+
loaded_clubs = loadClubs()
17+
assert loaded_clubs == clubs

0 commit comments

Comments
 (0)