def test_8_list_didaddresses_boundary(self):
        # did symbol does not exist in blockchain
        ec, message = mvs_rpc.list_didaddresses(Zac.did_symbol)
        self.assertEqual(ec, 7006, message)

        ec, message = mvs_rpc.list_didaddresses(Zac.mainaddress())
        self.assertEqual(ec, 4017, message)
    def test_7_change_did(self):
        '''modify did between Zac's addresses'''
        temp_did = "ZAC.DIID@" + common.get_timestamp()
        Alice.send_etp(Zac.mainaddress(), 10**8)
        Alice.mining()
        ec, message = mvs_rpc.register_did(Zac.name, Zac.password,
                                           Zac.mainaddress(), temp_did)
        self.assertEqual(ec, 0, message)
        Alice.mining()

        # no enough balance, unspent = 0, payment = 10000
        ec, message = mvs_rpc.change_did(Zac.name, Zac.password,
                                         Zac.addresslist[1], temp_did)
        self.assertEqual(ec, 3302, message)

        Alice.send_etp(Zac.addresslist[1], 10**4)
        Alice.mining()

        ec, message = mvs_rpc.change_did(Zac.name, Zac.password,
                                         Zac.addresslist[1], temp_did)
        self.assertEqual(ec, 0, message)
        Alice.mining()

        ec, message = mvs_rpc.list_dids(Zac.name, Zac.password)
        self.assertEqual(ec, 0, message)

        self.assertEqual(message['dids'][0]['symbol'], temp_did, message)
        self.assertEqual(message['dids'][0]['address'], Zac.addresslist[1],
                         message)

        # confirm the modification procedure by list_didaddresses
        ec, message = mvs_rpc.list_didaddresses(temp_did)
        self.assertEqual(ec, 0, message)

        self.assertEqual(message['addresses'][0]["address"],
                         Zac.addresslist[1])
        self.assertEqual(message['addresses'][0]["status"], "current")

        self.assertEqual(message['addresses'][1]["address"],
                         Zac.addresslist[0])
        self.assertEqual(message['addresses'][1]["status"], "history")
Пример #3
0
 def get_didaddress(self, symbol):
     ec, message = mvs_rpc.list_didaddresses(symbol)
     assert(ec == 0)
     return message[0]['address']