示例#1
0
    def test_execute_w3_data():
        """
        This test is replicating when the user clicks on
        'Execute Sequence' button at the bottom right of w3.
        """
        job_command = ""
        target_item = ""
        brain_db = "Brain"
        plugin_table = "Plugin1"
        command = "echo"
        jobs_table = "Jobs"

        for command_item in get_specific_command(plugin_table, command):
            job_command = command_item

        for target_item in get_specific_brain_targets(plugin_table):
            break
        inserted = rtdb.db(brain_db).table(jobs_table).insert([{
            "id":
            ECHO_JOB_ID,
            "JobTarget":
            target_item,
            "Status":
            "Ready",
            "StartTime":
            0,
            "JobCommand":
            job_command
        }]).run(connect())
        assert inserted['inserted'] == 1
示例#2
0
 def test_display_capability_list():
     """
     This test is replicating when a user clicks on a
     plugin from W1 and command list will be displayed in W2.
     """
     cur_var = rtdb.db("Plugins").table("Plugin1").pluck(
         'OptionalInput', 'Inputs', 'Tooltip', 'CommandName',
         'Output').run(connect())
     for plugin_item in cur_var:
         assert isinstance(plugin_item, dict)
示例#3
0
    def test_target_list(self):
        """
        This test queries all the targets in
        Brain.Targets to be displayed in W1.
        """
        db_name = "Brain"
        db_table = "Targets"
        query_plugin_names = rtdb.db(db_name).table(db_table).pluck(
            'PluginName', 'Location').run(connect())

        for plugin_item in query_plugin_names:
            assert isinstance(plugin_item, dict)
示例#4
0
 def test_display_w4_data():
     """
     This test is replicating the data displayed in W4 when a user clicks
     on 'Execute Sequence' button at the bottom right of w3.
     """
     brain_db = "Brain"
     output_table = "Outputs"
     process_var = Process(target=switch_to_done)
     process_var.start()
     sleep(2)
     command_document = rtdb.db(brain_db).table(output_table).filter({
         "JobCommand": {
             'id': ECHO_JOB_ID
         }
     }).run(connect())
     for query_item in command_document:
         assert isinstance(query_item, dict)
     process_var.terminate()
     os.kill(process_var.pid, signal.SIGKILL)
示例#5
0
 def test_add_target():
     """
     This test is replicating the data if the form is validated it
     will insert the new target to Brain.Targets table.
     """
     plugin_name = "Plugin1"
     location_num = location_generated_num("172.16.5.")
     port_num = "8002"
     optional_char = ""
     inserted_new_target = rtdb.db("Brain").table("Targets").insert([{
         "PluginName":
         plugin_name,
         "Location":
         location_num,
         "Port":
         port_num,
         "Optional":
         optional_char
     }]).run(connect())
     assert inserted_new_target['inserted'] == 1