def transaction__remove_transaction(self, args): import os from sample_agent import Agent from sample_config import Config from sample_transaction import Transaction text = "This test checks transaction.remove_transaction \n" self.print_info(text) # # INITIALIZATION # environment_directory = str(args[0]) identifier = str(args[1]) log_directory = str(args[2]) # Configure logging parameters so we get output while the program runs logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S', filename=log_directory + identifier + ".log", level=logging.INFO) logging.info('START logging for test transaction__remove_transaction in run: %s', environment_directory + identifier + ".xml") # Construct a config config = Config() agent_one = Agent("agent_one", {"test": "parameters"}, {"test": "variables"}) agent_two = Agent("agent_two", {"test": "parameters"}, {"test": "variables"}) config.agents = [] config.agents.append(agent_one) config.agents.append(agent_two) # # TESTING # print("Creating a transaction") transaction = Transaction() print("Assigning values") transaction.this_transaction("type", "asset", "agent_one", "agent_two", 1, 2, 3, 4) print("Adding the transaction to the books") transaction.add_transaction(config) print("The transaction:") print(transaction) print("Agent one:") print(config.get_agent_by_id("agent_one")) print("Agent two:") print(config.get_agent_by_id("agent_two")) print("Removing the transaction") transaction.remove_transaction() print("The transaction:") print(transaction) print("Agent one:") print(config.get_agent_by_id("agent_one")) print("Agent two:") print(config.get_agent_by_id("agent_two")) print("Removing the transaction")
def transaction__purge_accounts(self, args): import os from sample_agent import Agent from sample_config import Config from sample_transaction import Transaction text = "This test checks transaction.purge_accounts \n" self.print_info(text) # # INITIALIZATION # environment_directory = str(args[0]) identifier = str(args[1]) log_directory = str(args[2]) # Configure logging parameters so we get output while the program runs logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S', filename=log_directory + identifier + ".log", level=logging.INFO) logging.info( 'START logging for test transaction__purge_accounts in run: %s', environment_directory + identifier + ".xml") # Construct a config config = Config() agent_one = Agent("agent_one", {"test": "parameters"}, {"test": "variables"}) agent_two = Agent("agent_two", {"test": "parameters"}, {"test": "variables"}) config.agents = [] config.agents.append(agent_one) config.agents.append(agent_two) # # TESTING # print("Before purging the accounts") transaction = Transaction() transaction.this_transaction("type", "asset", "agent_one", "agent_two", 0, 2, 3, 4) transaction.add_transaction(config) transaction = Transaction() transaction.this_transaction("type", "asset", "agent_one", "agent_two", 1, 2, 3, 4) transaction.add_transaction(config) print(config.get_agent_by_id("agent_one")) print(config.get_agent_by_id("agent_two")) print("After clearing one bank's accounts") transaction.purge_accounts(config) print(config.get_agent_by_id("agent_one")) print(config.get_agent_by_id("agent_two"))
def transaction__purge_accounts(self, args): import os from sample_agent import Agent from sample_config import Config from sample_transaction import Transaction text = "This test checks transaction.purge_accounts \n" self.print_info(text) # # INITIALIZATION # environment_directory = str(args[0]) identifier = str(args[1]) log_directory = str(args[2]) # Configure logging parameters so we get output while the program runs logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S', filename=log_directory + identifier + ".log", level=logging.INFO) logging.info('START logging for test transaction__purge_accounts in run: %s', environment_directory + identifier + ".xml") # Construct a config config = Config() agent_one = Agent("agent_one", {"test": "parameters"}, {"test": "variables"}) agent_two = Agent("agent_two", {"test": "parameters"}, {"test": "variables"}) config.agents = [] config.agents.append(agent_one) config.agents.append(agent_two) # # TESTING # print("Before purging the accounts") transaction = Transaction() transaction.this_transaction("type", "asset", "agent_one", "agent_two", 0, 2, 3, 4) transaction.add_transaction(config) transaction = Transaction() transaction.this_transaction("type", "asset", "agent_one", "agent_two", 1, 2, 3, 4) transaction.add_transaction(config) print(config.get_agent_by_id("agent_one")) print(config.get_agent_by_id("agent_two")) print("After clearing one bank's accounts") transaction.purge_accounts(config) print(config.get_agent_by_id("agent_one")) print(config.get_agent_by_id("agent_two"))
def transaction__remove_transaction(self, args): import os from sample_agent import Agent from sample_config import Config from sample_transaction import Transaction text = "This test checks transaction.remove_transaction \n" self.print_info(text) # # INITIALIZATION # environment_directory = str(args[0]) identifier = str(args[1]) log_directory = str(args[2]) # Configure logging parameters so we get output while the program runs logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S', filename=log_directory + identifier + ".log", level=logging.INFO) logging.info( 'START logging for test transaction__remove_transaction in run: %s', environment_directory + identifier + ".xml") # Construct a config config = Config() agent_one = Agent("agent_one", {"test": "parameters"}, {"test": "variables"}) agent_two = Agent("agent_two", {"test": "parameters"}, {"test": "variables"}) config.agents = [] config.agents.append(agent_one) config.agents.append(agent_two) # # TESTING # print("Creating a transaction") transaction = Transaction() print("Assigning values") transaction.this_transaction("type", "asset", "agent_one", "agent_two", 1, 2, 3, 4) print("Adding the transaction to the books") transaction.add_transaction(config) print("The transaction:") print(transaction) print("Agent one:") print(config.get_agent_by_id("agent_one")) print("Agent two:") print(config.get_agent_by_id("agent_two")) print("Removing the transaction") transaction.remove_transaction() print("The transaction:") print(transaction) print("Agent one:") print(config.get_agent_by_id("agent_one")) print("Agent two:") print(config.get_agent_by_id("agent_two")) print("Removing the transaction")