Beispiel #1
0
 def doit(timeout=1000):
     txt = dev.send_recv(CCProtocolPacker.hsm_status(), timeout=timeout)
     assert txt[0] == '{'
     assert txt[-1] == '}'
     j = json.loads(txt, object_hook=DICT)
     assert j.active in {True, False}
     if 'users' in j or 'wallets' in j:
         assert 'users' in j
         assert j.active or ('wallets' in j)
     assert 'chain' in j
     return j
Beispiel #2
0
    def doit():
        # make sure we can setup an HSM now; often need to restart simulator tho

        # clear defined config
        cmd = 'import uos, hsm; uos.unlink(hsm.POLICY_FNAME)'
        sim_exec(cmd)

        # reset HSM code, to clear previous HSM setup
        while 1:
            j = json.loads(dev.send_recv(CCProtocolPacker.hsm_status()))
            if j.get('active') == False:
                break

            # reset out of HSM mode
            cmd = 'from hsm_ux import hsm_ux_obj; hsm_ux_obj.test_restart = True'
            sim_exec(cmd)
            time.sleep(.1)