@@ -42,6 +42,12 @@ def test_calculate(self):
4242 self .assertTrue (
4343 protocol .isProofOfWorkSufficient (pack ('>Q' , nonce ) + payload ))
4444
45+ # pylint: disable=import-outside-toplevel
46+ from class_singleWorker import singleWorker
47+
48+ self .assertTrue (protocol .isProofOfWorkSufficient (
49+ singleWorker ._doPOWDefaults (payload , default_ttl )))
50+
4551
4652@unittest .skipUnless (
4753 os .getenv ('BITMESSAGE_TEST_POW' ), "BITMESSAGE_TEST_POW is not set" )
@@ -67,6 +73,23 @@ def test_calculate(self):
6773 pack ('>Q' , nonce ) + payload , 2000 , 2000 ,
6874 int (time .time ()) + TTL - 3600 ))
6975
76+ # pylint: disable=import-outside-toplevel
77+ from class_singleWorker import singleWorker
78+
79+ with self .assertLogs ('default' ) as cm :
80+ self .assertTrue (protocol .isProofOfWorkSufficient (
81+ singleWorker ._doPOWDefaults (payload , TTL , log_prefix = '+' )))
82+ self .assertEqual (
83+ cm .output [0 ],
84+ 'INFO:default:+ Doing proof of work... TTL set to %s' % TTL )
85+ self .assertEqual (
86+ cm .output [1 ][:34 ], 'INFO:default:+ Found proof of work' )
87+
88+ with self .assertLogs ('default' ) as cm :
89+ self .assertTrue (protocol .isProofOfWorkSufficient (
90+ singleWorker ._doPOWDefaults (payload , TTL , log_time = True )))
91+ self .assertEqual (cm .output [2 ][:22 ], 'INFO:default:PoW took ' )
92+
7093 with self .assertRaises (StopIteration ):
7194 self .state .shutdown = 1
7295 proofofwork .calculate (payload , TTL )
0 commit comments