Skip to content

Commit 58edbf5

Browse files
Add test
1 parent 94e1439 commit 58edbf5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

tests/manual_test_nwcwallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def error_callback(self, error):
3434
print(f"error_callback called, error: {error}")
3535
self.error_callback_called += 1
3636

37-
3837
def update_balance(self, sats):
3938
"""
4039
Updates the user balance by 'sats' amount using the local API.
@@ -193,3 +192,4 @@ def test_it(self):
193192
print("test finished")
194193

195194

195+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import time
2+
import unittest
3+
4+
import sys
5+
sys.path.append("apps/com.lightningpiggy.displaywallet/assets/")
6+
from wallet import NWCWallet
7+
8+
class TestNWCWalletMultiRelayStartStop(unittest.TestCase):
9+
10+
def unused_callback(self, arg1=None, arg2=None):
11+
pass
12+
13+
def test_quick_start_stop(self):
14+
self.wallet = NWCWallet("nostr+walletconnect://e46762afab282c324278351165122345f9983ea447b47943b052100321227571?relay=ws://192.168.1.16:5000/nostrclient/api/v1/relay&relay=ws://127.0.0.1:5000/nostrrelay/test&secret=fab0a9a11d4cf4b1d92e901a0b2c56634275e2fa1a7eb396ff1b942f95d59fd3&lud16=test@example.com")
15+
for iteration in range(20):
16+
print(f"\n\nITERATION {iteration}\n\n")
17+
self.wallet.start(self.unused_callback, self.unused_callback, self.unused_callback, self.unused_callback)
18+
time.sleep(max(15-iteration,1)) # not giving any time to connect causes a bad state
19+
self.wallet.stop()
20+
time.sleep(0.2) # 0.1 seems to be okay most of the time, 0.2 is super stable

0 commit comments

Comments
 (0)