File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ import asyncio
2+ import unittest
3+ import os
4+ import coc
5+
6+ # Siege data was grabbed from:
7+ # https://clashofclans.fandom.com/wiki/Workshop
8+ MACHINES = {
9+ "Siege Barracks" :
10+ {
11+ "release" : 13 ,
12+ "max_at" : [
13+ {
14+ "th" : 13 ,
15+ "max" : 4
16+ }
17+ ]
18+ },
19+
20+ "Wall Wrecker" :
21+ {
22+ "release" : 12 ,
23+ "max_at" : [
24+ {
25+ "th" : 13 ,
26+ "max" : 4
27+ }
28+ ]
29+ },
30+
31+ }
32+
33+
34+ class TestTroopLevel (unittest .IsolatedAsyncioTestCase ):
35+ def setUp (self ) -> None :
36+ self .coc_client = coc .Client ()
37+ self .machines = MACHINES
38+
39+ async def asyncSetUp (self ) -> None :
40+ await asyncio .sleep (1 )
41+ try :
42+ await self .coc_client .login (os .environ .get ("DEV_SITE_EMAIL" ),
43+ os .environ .get (
44+ "DEV_SITE_PASSWORD" ))
45+ except Exception as error :
46+ self .fail (msg = error )
47+
48+ async def asyncTearDown (self ) -> None :
49+ await self .coc_client .close ()
50+
51+ def test_siege_machines (self ):
52+ for machine_key in self .machines .keys ():
53+ machine = self .machines .get (machine_key )
54+
55+ machine_obj = self .coc_client .get_troop (
56+ name = machine_key ,
57+ townhall = machine .get ("release" ) - 1 )
58+
59+ self .assertEqual (0 , machine_obj .get_max_level_for_townhall (12 ))
60+
61+
62+ if __name__ == '__main__' :
63+ unittest .main ()
You can’t perform that action at this time.
0 commit comments