# coding: utf-8 from __future__ import absolute_import import time import pytest from cic_eth.server.app import create_app @pytest.fixture def client(): print("Here") app = create_app({'TESTING': True}) with app.test_client() as client: # with app.app_context(): # init_db() yield client def test_account(client): query_string = [('password', ''), ('register', True)] response = client.open( '/create_account', method='POST', query_string=query_string) address_1 = response.get_json() print(address_1) query_string = [('password', ''), ('register', True)] response = client.open( '/create_account', method='POST', query_string=query_string) address_2 = response.get_json() print(address_2) time.sleep(10) # Balance query_string = [('address', address_1), ('token_symbol', 'COFE'), ('include_pending', True)] response = client.open( '/balance', method='GET', query_string=query_string) balance = response.get_json() print(balance) # Transfer query_string = [('from_address', address_1), ('to_address', address_2), ('value', 100), ('token_symbol', 'COFE')] response = client.open( '/transfer', method='POST', query_string=query_string) transfer = response.get_json() print(transfer) # def test_list_transactions(client): # """Test case for list_transactions # """ # query_string = [('address', "test_address"), # ('limit', 10)] # response = client.open( # '/transactions', # method='GET', # query_string=query_string) # self.assert200(response, # 'Response body is : ' + response.data.decode('utf-8')) # def test_transfer(client): # """Test case for transfer # """ # query_string = [('from_address', "test_address"), # ('to_address', "test_address"), # ('value', 56), # ('token_symbol', 'token_symbol_example')] # response = client.open( # '/transfer', # method='POST', # query_string=query_string) # self.assert200(response, # 'Response body is : ' + response.data.decode('utf-8')) # def test_transfer_from(client): # """Test case for transfer_from # """ # query_string = [('from_address', "test_address"), # ('to_address', "test_address"), # ('value', 56), # ('token_symbol', 'token_symbol_example'), # ('spender_address', "test_address")] # response = client.open( # '/transfer_from', # method='POST', # query_string=query_string) # self.assert200(response, # 'Response body is : ' + response.data.decode('utf-8'))