razaali10 commited on
Commit
a9f04e7
·
verified ·
1 Parent(s): f7a6add

Create tests/test_fake_client.py

Browse files
Files changed (1) hide show
  1. tests/test_fake_client.py +46 -0
tests/test_fake_client.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pcswmm_ai import PCSWMMClient
2
+
3
+
4
+ class FakeCollection(dict):
5
+ @property
6
+ def Count(self):
7
+ return len(self)
8
+
9
+ @property
10
+ def Keys(self):
11
+ return list(self.keys())
12
+
13
+
14
+ class FakeSWMM:
15
+ ProjectName = "Test Project"
16
+ ProjectFolder = r"C:\Test"
17
+ FilePath = r"C:\Test\model.inp"
18
+ Version = "SWMM5.2.3"
19
+ RunStatus = "Ready"
20
+ Scenarios = FakeCollection({"Base": object()})
21
+ Nodes = FakeCollection({"N1": object()})
22
+ Links = FakeCollection({"L1": object()})
23
+ Junctions = FakeCollection({})
24
+ Conduits = FakeCollection({})
25
+ Subcatchments = FakeCollection({"S1": object()})
26
+ Storages = FakeCollection({})
27
+ Outfalls = FakeCollection({})
28
+
29
+ def run(self):
30
+ return None
31
+
32
+
33
+ class FakeGraph:
34
+ Files = []
35
+
36
+
37
+ class FakePCPY:
38
+ SWMM = FakeSWMM()
39
+ Graph = FakeGraph()
40
+
41
+
42
+ def test_project_summary():
43
+ client = PCSWMMClient(FakePCPY())
44
+ summary = client.project.summary()
45
+ assert summary["project_name"] == "Test Project"
46
+ assert summary["node_count"] == 1