コード例 #1
0
ファイル: api_tests.py プロジェクト: warrenween/evt
    def test_get_actions(self):
        req = {
            'domain': '.fungible',
            'key': '.issue',
            'names': [
                'issuetoken'
            ],
            'dire': 'asc',
            'skip': 0,
            'take': 10
        }
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('block_num' in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {
            'domain': '.fungible',
            'key': 3,
            'names': [
                'everipay'
            ],
            'dire': 'asc',
            'skip': 0,
            'take': 10
        }
        req['key'] = sym_id

        resp = api.get_actions(json.dumps(req)).text
        self.assertTrue('everipay' in resp, msg=resp)
        self.assertTrue('block_num' in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)
コード例 #2
0
ファイル: api_tests.py プロジェクト: zhaojiaxing/evt
    def test_get_actions(self):
        req = {'domain': '.fungible', 'skip': 0, 'take': 10}
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 4, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue('T' in res_dict[0]['timestamp'],
                        msg=res_dict[0]['timestamp'])
        self.assertTrue(type(iso8601.parse_date(res_dict[0]['timestamp'])) is
                        datetime.datetime,
                        msg=res_dict[0]['timestamp'])
        self.assertTrue(token1_name in resp, msg=resp)

        req = {'domain': '.fungible', 'dire': 'asc', 'skip': 0, 'take': 10}
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 4, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {'domain': '.fungible', 'key': '.issue', 'skip': 0, 'take': 10}
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 1, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {
            'domain': '.fungible',
            'key': '.issue',
            'dire': 'asc',
            'skip': 0,
            'take': 10
        }
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 1, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {
            'domain': '.fungible',
            'names': ['issuetoken'],
            'skip': 0,
            'take': 10
        }
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 1, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {
            'domain': '.fungible',
            'names': ['issuetoken'],
            'dire': 'asc',
            'skip': 0,
            'take': 10
        }
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 1, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {
            'domain': '.fungible',
            'names': ['issuetoken'],
            'key': '.issue',
            'skip': 0,
            'take': 10
        }
        req['domain'] = domain_name

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 1, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)

        req = {
            'domain': '.fungible',
            'key': 3,
            'names': ['everipay'],
            'dire': 'asc',
            'skip': 0,
            'take': 10
        }
        req['key'] = sym_id

        resp = api.get_actions(json.dumps(req)).text
        res_dict = json.loads(resp)
        self.assertEqual(len(res_dict), 3, msg=resp)
        self.assertTrue('trx_id' in res_dict[0].keys(), msg=resp)
        self.assertTrue('name' in res_dict[0].keys(), msg=resp)
        self.assertTrue('domain' in res_dict[0].keys(), msg=resp)
        self.assertTrue('key' in res_dict[0].keys(), msg=resp)
        self.assertTrue('data' in res_dict[0].keys(), msg=resp)
        self.assertTrue('timestamp' in res_dict[0].keys(), msg=resp)
        self.assertTrue('everipay' in resp, msg=resp)
        self.assertTrue('timestamp' in resp, msg=resp)