@@ -78,17 +78,13 @@ def test_4_set_infura(self):
7878
7979 def test_5_print_account (self ):
8080 result = execute (["account" , "print" ], self .parser , self .conf )
81+ print (result )
8182 assert ADDR in result
8283
8384
84- class TestCommands (BaseTest ):
85+ class TestABCommands (BaseTest ):
8586 def setUp (self ):
8687 super ().setUp ()
87- file_path = '../../../../version.py'
88- spec = importlib .util .spec_from_file_location ("version" , file_path )
89- version_module = importlib .util .module_from_spec (spec )
90- spec .loader .exec_module (version_module )
91- self .version = version_module .__version__
9288
9389 def test_balance_output (self ):
9490 result = execute (["account" , "balance" ], self .parser , self .conf )
@@ -99,12 +95,18 @@ def test_balance_address(self):
9995 assert result .split ("\n " )[0 ].split ()[1 ] == ADDR
10096
10197 def test_version (self ):
98+ file_path = "./version.py"
99+ spec = importlib .util .spec_from_file_location ("version" , file_path )
100+ version_module = importlib .util .module_from_spec (spec )
101+ spec .loader .exec_module (version_module )
102+ self .version = version_module .__version__
102103 result = execute (["version" ], self .parser , self .conf )
103104 print ("Version of CLI: " , self .version )
105+ print (result )
104106 assert f"version: { self .version } " in result
105107
106108
107- class TestDepositWithdraw (BaseTest ):
109+ class TestACDepositWithdraw (BaseTest ):
108110 def setUp (self ):
109111 super ().setUp ()
110112 self .balance_1 : int
@@ -117,18 +119,20 @@ def test_deposit(self):
117119 execute (["account" , "deposit" , f"{ self .amount } " , "-y" , "-q" ], self .parser , self .conf )
118120 result = execute (["account" , "balance" ], self .parser , self .conf )
119121 self .balance_2 = float (result .split ("\n " )[3 ].split ()[1 ])
120- assert self .balance_2 == self .balance_1 + self .amount
122+ print (round (self .balance_2 , 5 ), " == " , round (self .balance_1 , 5 ), " + " , self .amount )
123+ assert round (self .balance_2 , 5 ) == round (self .balance_1 , 5 ) + self .amount
121124
122125 def test_withdraw (self ):
123126 result = execute (["account" , "balance" ], self .parser , self .conf )
124127 self .balance_1 = float (result .split ("\n " )[3 ].split ()[1 ])
125128 execute (["account" , "withdraw" , f"{ self .amount } " , "-y" , "-q" ], self .parser , self .conf )
126129 result = execute (["account" , "balance" ], self .parser , self .conf )
127130 self .balance_2 = float (result .split ("\n " )[3 ].split ()[1 ])
128- assert self .balance_2 == self .balance_1 - self .amount
131+ print (round (self .balance_2 , 5 ), " == " , round (self .balance_1 , 5 ), " - " , self .amount )
132+ assert round (self .balance_2 , 5 ) == round (self .balance_1 , 5 ) - self .amount
129133
130134
131- class TestGenerateLibrary (BaseTest ):
135+ class TestADGenerateLibrary (BaseTest ):
132136 def setUp (self ):
133137 super ().setUp ()
134138 self .path = './temp_files'
@@ -165,10 +169,10 @@ def test_unset_current_singularitynettoken_at(self):
165169 assert "unset" in result
166170
167171
168- class TestEncryptionKey (BaseTest ):
172+ class TestAEEncryptionKey (BaseTest ):
169173 def setUp (self ):
170174 super ().setUp ()
171- self .key = "1234567890123456789012345678901234567890123456789012345678901234"
175+ self .key = PRIVATE_KEY
172176 self .password = "some_pass"
173177 self .name = "some_name"
174178 self .default_name = "default_name"
@@ -202,7 +206,7 @@ def test_3_delete_identity(self):
202206 assert self .name not in result
203207
204208
205- class TestOrgMetadata (BaseTest ):
209+ class TestAFOrgMetadata (BaseTest ):
206210 def setUp (self ):
207211 super ().setUp ()
208212 self .success_msg = "Organization metadata is valid and ready to publish."
@@ -229,7 +233,7 @@ def tearDown(self):
229233 os .remove (f"./organization_metadata.json" )
230234
231235
232- class TestChannels (BaseTest ):
236+ class TestAGChannels (BaseTest ):
233237 def setUp (self ):
234238 super ().setUp ()
235239 self .ID_flag = "--only-id"
@@ -242,12 +246,13 @@ def test_channel_print_all(self):
242246 maximum_first = max (int (x ) for x in result .split () if x .isdigit ())
243247
244248 def test_channel_extend (self ):
245- with mock . patch ( 'getpass.getpass' , return_value = self .password ):
246- result = execute (["channel" , "extend-add" , self .ID , "--amount" , self .amount , "-y" ], self .parser , self .conf )
247- assert "channelId: " , self .ID in result
249+ execute ([ "account" , "deposit" , self . amount , "-y" , "-q" ], self . parser , self .conf )
250+ result = execute (["channel" , "extend-add" , self .ID , "--amount" , self .amount , "-y" ], self .parser , self .conf )
251+ assert "channelId: " , self .ID in result
248252
249253
250- class TestClient (BaseTest ):
254+ ''' TODO
255+ class TestAHClient(BaseTest):
251256 def setUp(self):
252257 super().setUp()
253258 self.org_id="SNet"
@@ -269,8 +274,11 @@ def test_0_preparations(self):
269274 assert "network: sepolia" in result
270275
271276 def test_1_channel_open(self):
272- print (execute (["set" , "default_eth_rpc_endpoint" , INFURA_KEY ], self .parser , self .conf ))
273- result = execute (["channel" , "open" , self .org_id , "default_group" , "0.1" , "+15days" , "-y" ], self .parser , self .conf )
277+ execute(["account", "deposit", "0.001", "-y"], self.parser, self.conf)
278+ execute(["set", "default_eth_rpc_endpoint", INFURA], self.parser, self.conf)
279+ self.block=int(execute(["channel", "block-number"], self.parser, self.conf))
280+ print(self.block)
281+ result=execute(["channel", "open", self.org_id, "default_group", "0.1", f"{self.block+100000}", "-y"], self.parser, self.conf)
274282 print("res "+result)
275283 for line in result.splitlines():
276284 if "channelId" in line:
@@ -283,9 +291,10 @@ def test_1_channel_open(self):
283291 def test_2_service_call(self):
284292 result=execute(["client", "call", self.org_id, self.service_id, self.group, self.method, self.params, "--channel-id", self.channel_id], self.parser, self.conf)
285293 assert "42" in result
294+ '''
286295
287296
288- class TestOrganization (BaseTest ):
297+ class TestAIOrganization (BaseTest ):
289298 def setUp (self ):
290299 super ().setUp ()
291300 self .org_id = "singularitynet"
@@ -300,7 +309,7 @@ def test_org_info(self):
300309 assert "Organization Name" in result
301310
302311
303- class TestOnboardingOrg (BaseTest ):
312+ class TestAJOnboardingOrg (BaseTest ):
304313 def setUp (self ):
305314 super ().setUp ()
306315 self .identity_name = "some_name"
@@ -343,4 +352,4 @@ def test_3_delete_organization(self):
343352
344353
345354if __name__ == "__main__" :
346- unittest .main ()
355+ unittest .main ()
0 commit comments