Esempio n. 1
0
    def test_get_tokens(self):

        req = {'keys': [user.pub_key.to_string()]}
        req['domain'] = domain_name
        req['name'] = token1_name
        resp = api.get_tokens(json.dumps(req)).text
        self.assertTrue(token1_name in resp, msg=resp)
        self.assertFalse(token2_name in resp, msg=resp)
        self.assertFalse(token3_name in resp, msg=resp)

        req['domain'] = domain_name
        resp = api.get_tokens(json.dumps(req)).text
        self.assertTrue(token1_name in resp, msg=resp)

        req['name'] = token1_name
        resp = api.get_tokens(json.dumps(req)).text
        self.assertTrue(token1_name in resp, msg=resp)
Esempio n. 2
0
 def test_get_tokens(self):
     req = {'skip': 0, 'take': 10}
     req['domain'] = domain_name
     resp = api.get_tokens(json.dumps(req)).text
     res_dict = json.loads(resp)
     self.assertEqual(len(res_dict), 3, msg=resp)
     self.assertEqual(res_dict[0]['name'], token3_name, msg=resp)
     self.assertEqual(res_dict[0]['domain'], domain_name, msg=resp)
     self.assertTrue('owner' in res_dict[0].keys())