def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id1 = generate_entity_id("bulk_agent") cls.agent_id2 = generate_entity_id("bulk_agent") cls.generator_id1 = generate_entity_id("bulk_generator") cls.generator_id2 = generate_entity_id("bulk_generator") cls.filter = [cls.agent_id1, cls.agent_id2]
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id1 = generate_entity_id("test_delete_g_bulk_a1") cls.agent_id2 = generate_entity_id("test_delete_g_bulk_a2") cls.generator_id1 = generate_entity_id("test_delete_g_bulk_g1") cls.filter = [cls.agent_id1, cls.agent_id2] cls.generator_configuration = valid_data.VALID_GENERATOR_CONFIGURATION.copy( ) cls.generator_configuration["filter"] = cls.filter
def setUpClass(cls): add = "3" cls.client = Client(settings.CRAFT_CFG) cls.agent_id1 = generate_entity_id("test_create_gen_bulk_ag" + add) cls.agent_id2 = generate_entity_id("test_create_gen_bulk_ag" + add) cls.generator_id1 = generate_entity_id("test_create_gen_bulk_gen" + add) cls.generator_id2 = generate_entity_id("test_create_gen_bulk_gen" + add) cls.filter = [cls.agent_id1, cls.agent_id2]
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id = generate_entity_id("test_get_state")
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id = generate_entity_id(AGENT_ID_1_BASE + "SomeFailure")
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG)
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id1 = generate_entity_id(AGENT_ID_1_BASE + "Success") cls.agent_id2 = generate_entity_id(AGENT_ID_2_BASE + "Success")
import unittest from craft_ai import Client, Interpreter, Time, errors as craft_err from . import settings HERE = os.path.abspath(os.path.dirname(__file__)) # Assuming we are the test folder and the folder hierarchy is correctly # constructed EXPECS_DIR = os.path.join(HERE, "data", "interpreter", "decide", "expectations") TREES_DIR = os.path.join(HERE, "data", "interpreter", "decide", "trees") CLIENT = Client(settings.CRAFT_CFG) class TestInterpreter(unittest.TestCase): def check_expectation(self, tree, expectation): exp_context = expectation["context"] timestamp = None exp_time = expectation.get("time") time = Time(exp_time["t"], exp_time["tz"]) if exp_time else {} configuration = expectation.get("configuration") if configuration: tree["configuration"].update(configuration) if expectation.get("error"): with self.assertRaises( craft_err.CraftAiDecisionError) as context_manager:
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agents = [ generate_entity_id("test_delete_agents_bulk") for i in range(NB_AGENTS_TO_DELETE) ]
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id1 = generate_entity_id("test_delete_agents_bulk") cls.agent_id2 = generate_entity_id("test_delete_agents_bulk")
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id = generate_entity_id("get_inspector_url")
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id = generate_entity_id("test_create_gen_agent_FAIL") cls.generator_id = generate_entity_id("test_create_gen_gen_FAIL") cls.filter = [cls.agent_id]
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agent_id = generate_entity_id("test_add_agents_operations_bulk")
def setUpClass(cls): cls.client = Client(settings.CRAFT_CFG) cls.agents = [ generate_entity_id("test_add_agents_operations_bulk") for i in range(NB_AGENTS_TO_ADD_OPERATIONS) ]