예제 #1
0
    def test_1_new_address(self):
        '''new address for Zac'''
        max_duration = 0.01
        avg_duration = 0.002

        round = 5000

        Zac.create()
        account_table_file = '/home/%s/.metaverse/mainnet/account_table' % common.get_username(
        )

        try:
            origin_payload_size = database.get_payload_size(account_table_file)

            durations = []
            for i in range(round):
                duration, ret = common.duration_call(mvs_rpc.new_address,
                                                     Zac.name, Zac.password)
                self.assertEqual(ret[0], 0, "mvs_rpc.new_address failed!")
                self.assertLess(duration, max_duration)
                durations.append(duration)
            self.assertLess(sum(durations), avg_duration * round)

            current_payload_size = database.get_payload_size(
                account_table_file)

            # each simple account record size < 300
            self.assertGreater(
                300 * round, current_payload_size - origin_payload_size,
                "each account record size shall be less than 300.")
        finally:
            Zac.delete()
예제 #2
0
    def test_1_getaddressasset(self):
        round = 1000

        max_duration = 0.01
        avg_duration = 0.005
        durations = []

        for i in xrange(round):
            duration, ret = common.duration_call(mvs_rpc.get_addressasset,
                                                 Alice.mainaddress())
            self.assertEqual(ret[0], 0, "mvs_rpc.get_addressasset failed!")
            self.assertLess(duration, max_duration)
            durations.append(duration)
        self.assertLess(sum(durations), avg_duration * round)
예제 #3
0
    def test_0_getaccountasset(self):
        '''create 3000 address multisig address for Alice, and then ...'''
        address_amount = 3000
        addresses = mvs_rpc.new_address(Alice.name, Alice.password,
                                        address_amount)
        round = 5000

        max_duration = 0.01
        avg_duration = 0.002
        durations = []

        for i in xrange(round):
            print i
            duration, ret = common.duration_call(mvs_rpc.get_accountasset,
                                                 Alice.name, Alice.password)
            self.assertEqual(ret[0], 0, "mvs_rpc.get_accountasset failed!")
            self.assertLess(duration, max_duration)
            durations.append(duration)
        self.assertLess(sum(durations), avg_duration * round)