96 lines
3.0 KiB
Python
96 lines
3.0 KiB
Python
|
# coding: utf-8
|
||
|
|
||
|
from __future__ import absolute_import
|
||
|
|
||
|
from cic_eth.server.models.model0x_address import Model0xAddress # noqa: E501
|
||
|
from cic_eth.server.models.token import Token # noqa: E501
|
||
|
from cic_eth.server.models.token_balance import TokenBalance # noqa: E501
|
||
|
from cic_eth.server.test import BaseTestCase
|
||
|
from flask import json
|
||
|
from six import BytesIO
|
||
|
|
||
|
|
||
|
class TestAccountController(BaseTestCase):
|
||
|
"""AccountController integration test stubs"""
|
||
|
|
||
|
def test_account_balance(self):
|
||
|
"""Test case for account_balance
|
||
|
|
||
|
|
||
|
"""
|
||
|
query_string = [('address', Model0xAddress()),
|
||
|
('token_symbol', 'token_symbol_example'),
|
||
|
('include_pending', True)]
|
||
|
response = self.client.open(
|
||
|
'/balance',
|
||
|
method='GET',
|
||
|
query_string=query_string)
|
||
|
self.assert200(response,
|
||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||
|
|
||
|
def test_create_account_post(self):
|
||
|
"""Test case for create_account_post
|
||
|
|
||
|
|
||
|
"""
|
||
|
query_string = [('password', 'password_example'),
|
||
|
('register', true)]
|
||
|
response = self.client.open(
|
||
|
'/create_account',
|
||
|
method='POST',
|
||
|
query_string=query_string)
|
||
|
self.assert200(response,
|
||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||
|
|
||
|
def test_list_transactions(self):
|
||
|
"""Test case for list_transactions
|
||
|
|
||
|
|
||
|
"""
|
||
|
query_string = [('address', Model0xAddress()),
|
||
|
('limit', 10)]
|
||
|
response = self.client.open(
|
||
|
'/transactions',
|
||
|
method='GET',
|
||
|
query_string=query_string)
|
||
|
self.assert200(response,
|
||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||
|
|
||
|
def test_transfer(self):
|
||
|
"""Test case for transfer
|
||
|
|
||
|
|
||
|
"""
|
||
|
query_string = [('from_address', Model0xAddress()),
|
||
|
('to_address', Model0xAddress()),
|
||
|
('value', 56),
|
||
|
('token_symbol', 'token_symbol_example')]
|
||
|
response = self.client.open(
|
||
|
'/transfer',
|
||
|
method='POST',
|
||
|
query_string=query_string)
|
||
|
self.assert200(response,
|
||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||
|
|
||
|
def test_transfer_from(self):
|
||
|
"""Test case for transfer_from
|
||
|
|
||
|
|
||
|
"""
|
||
|
query_string = [('from_address', Model0xAddress()),
|
||
|
('to_address', Model0xAddress()),
|
||
|
('value', 56),
|
||
|
('token_symbol', 'token_symbol_example'),
|
||
|
('spender_address', Model0xAddress())]
|
||
|
response = self.client.open(
|
||
|
'/transfer_from',
|
||
|
method='POST',
|
||
|
query_string=query_string)
|
||
|
self.assert200(response,
|
||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
import unittest
|
||
|
unittest.main()
|