示例#1
0
    def __validate_static_directory(self):
        output = {"status": True, "message": ""}
        if os.path.isdir(join_path(self.path_to_app, "static")):
            subs = get_sub_dirs_and_files(join_path(self.path_to_app,
                                                    "static"))
            if len(subs["files"]) > 0:
                output["status"] = False
                output["message"] = "static directory does not follow the required " \
                                    "directory structure."
                print("-- An Error Occurred -- {0}".format(output["message"]))
            else:
                if not os.path.isdir(
                        join_path(self.path_to_app, "static", self.app_name)):
                    output["status"] = False
                    output["message"] = "static directory does not follow the required " \
                                        "directory structure."
                    print("-- An Error Occurred -- {0}".format(
                        output["message"]))
                else:

                    subs_files = get_paths_of_subfiles(
                        join_path(self.path_to_app, "static", self.app_name),
                        re.compile("\.js$"))
                    path_to_js = join_path(self.path_to_app, "static",
                                           self.app_name, "js")
                    for sub_file in subs_files:
                        if not sub_file.startswith(path_to_js):
                            output["status"] = False
                            output[
                                "message"] = "A .js file cannot be outside the 'js' folder."
                            print("-- An Error Occurred -- {0}".format(
                                output["message"]))
        return output
示例#2
0
    def ready(self):
        """
        The ready function is trigger only on events like server start up and server reload
        """
        # print "***************You are in Core Katana App Config Class***************"
        nav_obj = Navigator()

        base_directory = nav_obj.get_katana_dir()
        warrior_dir = nav_obj.get_warrior_dir()
        config_file_name = "wf_config.json"
        config_json_file = join_path(base_directory, "config.json")
        settings_file_path = get_abs_path(join_path("wui", "settings.py"), base_directory)
        core_index_obj = CoreIndex(base_directory, settings_file_path=settings_file_path)

        available_apps = core_index_obj.get_available_apps()
        settings_apps = core_index_obj.get_apps_from_settings_file()

        AppInformation.information = Apps()

        AppInformation.information.set_apps({'base_directory': base_directory,
                                             'config_file_name': config_file_name,
                                             'available_apps': available_apps,
                                             'settings_apps': settings_apps})

        ordered_json = validate_config_json(read_json_data(config_json_file), warrior_dir)
        with open(config_json_file, "w") as f:
            f.write(json.dumps(ordered_json, indent=4))
示例#3
0
 def __init__(self, filepath):
     self.navigator = Navigator()
     self.app_name = get_sub_folders(
         join_path(filepath, "warriorframework_py3", "katana", "wapps"))[0]
     self.path_to_app = join_path(filepath, "warriorframework_py3",
                                  "katana", "wapps", self.app_name)
     self.wf_config_file = join_path(self.path_to_app, "wf_config.json")
     self.urls_inclusions = []
     self.mandatory_fields = [
         "app", "version", "warrior-compatibility",
         "warrior-incompatibility"
     ]
示例#4
0
def open_config(request):
    config_name = request.GET['config_name']
    config_path = join_path(WappManagementView.dot_data_directory,
                            "{0}.xml".format(config_name))

    config_file_data_dir = join_path(WappManagementView.dot_data_directory,
                                     config_name)

    info = []
    show_install_btn = True
    with open(config_path, 'r') as f:
        data = f.read()
    tree = ET.ElementTree(ET.fromstring(data))
    apps = tree.findall('app')
    for app in apps:
        temp = {}
        if app.find('zip', None) is not None:
            node = app.find('zip', None)
            type_of_app = "zip"
            text = node.text
            if not os.path.exists(join_path(config_file_data_dir, text)):
                show_install_btn = False
                needs_update = True
            else:
                needs_update = False
        elif app.find('repository', None) is not None:
            node = app.find('repository', None)
            type_of_app = "repository"
            text = node.text
            needs_update = False
        else:
            node = app.find('filepath', None)
            type_of_app = "filepath"
            text = node.text
            if not os.path.exists(text):
                show_install_btn = False
                needs_update = True
            else:
                needs_update = False
        temp["name"] = text
        temp["type"] = type_of_app
        temp["needs_update"] = needs_update

        info.append(temp)

    output_data = {
        "config_name": config_name,
        "preference_details": info,
        "show_install_btn": show_install_btn
    }
    return render(request, 'wapp_management/config_details.html', output_data)
示例#5
0
    def __init__(self, base_directory, path_to_app):
        self.base_directory = base_directory
        self.app_directory = join_path(self.base_directory, "katana", "wapps")
        self.plugin_directory = join_path(self.base_directory, "warrior",
                                          "plugins")
        self.settings_file = join_path(self.base_directory, "katana", "wui",
                                       "settings.py")
        self.urls_file = join_path(self.base_directory, "katana", "wui",
                                   "urls.py")

        self.app_name = get_sub_folders(
            join_path(path_to_app, "warriorframework_py3", "katana",
                      "wapps"))[0]
        self.path_to_app = join_path(path_to_app, "warriorframework_py3",
                                     "katana", "wapps", self.app_name)
        self.path_to_plugin_dir = join_path(path_to_app,
                                            "warriorframework_py3", "warrior",
                                            "plugins")
        self.wf_config_file = join_path(self.path_to_app, "wf_config.json")

        self.plugins_paths = get_sub_folders(self.path_to_plugin_dir,
                                             abs_path=True)
        self.pkg_in_settings = "wapps.{0}".format(self.app_name)
        self.urls_inclusions = []
        self.settings_backup = []
        self.urls_backup = []
        self.delete_app_dir = []
        self.delete_plugins_dir = []
        self.config_data = None
        self.message = ""
示例#6
0
def read_config_file(request):
    nav_obj = Navigator()
    config_file_path = join_path(nav_obj.get_katana_dir(), "config.json")
    data = read_json_data(config_file_path)
    if data is None:
        data = False
    return JsonResponse(data)
 def __init__(self, json_data, path, base_directory):
     """Constructor of the App Class"""
     self.data = json_data
     self.path = get_relative_path(path, base_directory)
     self.static_file_dir = join_path("static", get_dir_from_path(path))
     self.app_type = get_dir_from_path(get_parent_directory(path))
     self.app_dir_name = get_dir_from_path(path)
示例#8
0
    def post(self, request):
        app_paths = request.POST.getlist("app_paths[]")
        filename = request.POST.get("filename")

        root = ET.Element("data")
        for app_path in app_paths:
            app = ET.SubElement(root, "app")
            if os.path.exists(app_path):
                ET.SubElement(app, "filepath").text = app_path
            else:
                ET.SubElement(app, "repository").text = app_path
        fpath = join_path(WappManagementView.dot_data_directory,
                          "{0}.xml".format(filename))
        xml_str = ET.tostring(root, encoding='utf8', method='xml')
        with open(fpath, "w") as f:
            f.write(xml_str)

        files = get_sub_files(WappManagementView.dot_data_directory)
        preferences = []
        for subfile in files:
            filename, file_extension = os.path.splitext(subfile)
            if file_extension == ".xml":
                preferences.append(filename)
        output_data = {"data": {"preferences": preferences}}

        return render(request, 'wapp_management/saved_preferences.html',
                      output_data)
    def prerequisites_handler(self, request):
        ref_file = join_path(self.static_dir, "base_templates", "empty.xml")
        prereqs = read_xml_get_json(ref_file)["data"]["warhorn"]["dependency"]
        prereq_data = []
        for prereq in prereqs:
            temp = {}
            for key, value in list(prereq.items()):
                temp[key.strip('@')] = value

            temp["status"] = "install"
            try:
                module_name = __import__(temp["name"])
                some_var = module_name.__version__
            except ImportError:
                temp["available_version"] = "--"
                temp["installBtnText"] = "Install"
            except Exception as e:
                print(
                    "-- An Exception Occurred -- while getting details about {0}: {1}"
                    .format(temp["name"], e))
                temp["available_version"] = "--"
                temp["installBtnText"] = "Install"
            else:
                temp["available_version"] = some_var
                if LooseVersion(str(temp["version"])) <= LooseVersion(
                        str(temp["available_version"])):
                    temp["installBtnText"] = "Installed"
                    temp["status"] = "installed"
                else:
                    temp["installBtnText"] = "Upgrade"
                    temp["status"] = "upgrade"

            prereq_data.append(copy.deepcopy(temp))
        return prereq_data
示例#10
0
def install_an_app(request):
    app_path = request.POST.get("app_paths")
    dot_data_dir = join_path(nav_obj.get_katana_dir(), "native",
                             "wapp_management", ".data")
    temp_dir_path = join_path(dot_data_dir, "temp")
    output_data = {"status": True, "message": ""}

    if os.path.exists(temp_dir_path):
        shutil.rmtree(temp_dir_path)
    create_dir(temp_dir_path)

    if app_path.endswith(".git"):
        repo_name = get_repository_name(app_path)
        os.system("git clone {0} {1}".format(
            app_path, join_path(temp_dir_path, repo_name)))
        app_path = join_path(temp_dir_path, repo_name)
    elif app_path.endswith(".zip"):
        if os.path.exists(app_path):
            temp = app_path.split(os.sep)
            temp = temp[len(temp) - 1]
            shutil.copyfile(app_path, join_path(temp_dir_path, temp))
            zip_ref = zipfile.ZipFile(join_path(temp_dir_path, temp), 'r')
            zip_ref.extractall(temp_dir_path)
            zip_ref.close()
            app_path = join_path(temp_dir_path, temp[:-4])
        else:
            output_data["status"] = False
            output_data[
                "message"] = "-- An Error Occurred -- {0} does not exist".format(
                    app_path)
            print(output_data["message"])
    else:
        if os.path.isdir(app_path):
            filename = get_dir_from_path(app_path)
            copy_dir(app_path, join_path(temp_dir_path, filename))
            app_path = join_path(temp_dir_path, filename)
        else:
            output_data["status"] = False
            output_data[
                "message"] = "-- An Error Occurred -- {0} does not exist".format(
                    app_path)
            print(output_data["message"])
    installer_obj = Installer(get_parent_directory(nav_obj.get_katana_dir()),
                              app_path)
    installer_obj.install()
    if installer_obj.message != "":
        output_data["status"] = False
        output_data["message"] += "\n" + installer_obj.message
    return JsonResponse(output_data)
示例#11
0
def validate_app_path(request):
    output = {"status": True, "message": ""}
    detail_type = request.POST.get("type", None)
    detail_info = request.POST.get("value", None)
    dot_data_dir = join_path(nav_obj.get_katana_dir(), "native",
                             "wapp_management", ".data")
    temp_dir_path = join_path(dot_data_dir, "temp")
    app_path = False

    if os.path.exists(temp_dir_path):
        shutil.rmtree(temp_dir_path)
    if create_dir(temp_dir_path):
        if detail_type == "repository":
            repo_name = get_repository_name(detail_info)
            os.system("git clone {0} {1}".format(
                detail_info, join_path(temp_dir_path, repo_name)))
            app_path = join_path(temp_dir_path, repo_name)
        elif detail_type == "zip":
            if os.path.exists(detail_info):
                temp = detail_info.split(os.sep)
                temp = temp[len(temp) - 1]
                shutil.copyfile(detail_info, join_path(temp_dir_path, temp))
                zip_ref = zipfile.ZipFile(join_path(temp_dir_path, temp), 'r')
                zip_ref.extractall(temp_dir_path)
                zip_ref.close()
                app_path = join_path(temp_dir_path, temp[:-4])
            else:
                output["status"] = False
                output["message"] = "{0} does not exist".format(detail_info)
                print("-- An Error Occurred -- ".format(output["message"]))
        elif detail_type == "filepath":
            if os.path.isdir(detail_info):
                filename = get_dir_from_path(detail_info)
                copy_dir(detail_info, join_path(temp_dir_path, filename))
                app_path = join_path(temp_dir_path, filename)
            else:
                output["status"] = False
                output[
                    "message"] = "{0} does not exist or is not a directory".format(
                        detail_info)
                print("-- An Error Occurred -- {0}".format(output["message"]))
        else:
            print("-- An Error Occurred -- Type of validation not given.")
        if app_path:
            app_validator_obj = AppValidator(app_path)
            output = app_validator_obj.is_valid()
    else:
        print("-- An Error Occurred -- Could not create temporary directory.")
    return JsonResponse(output)
示例#12
0
def check_if_file_exists(request):
    filename = request.POST.get("filename")
    directory = request.POST.get("directory")
    extension = request.POST.get("extension")
    path = request.POST.get("path")
    if path is not None:
        output = {"exists": file_or_dir_exists(path)}
    else:
        output = {"exists": file_or_dir_exists(join_path(directory, filename + extension))}
    return JsonResponse(output)
示例#13
0
def get_file_explorer_data(request):
    nav_obj = Navigator()
    if "data[start_dir]" in request.POST and request.POST["data[start_dir]"] != "false":
        start_dir = request.POST["data[start_dir]"]
    elif "data[path]" in request.POST and request.POST["data[path]"] != "false":
        start_dir = get_parent_directory(request.POST["data[path]"])
    else:
        start_dir = join_path(nav_obj.get_warrior_dir(), "Warriorspace")
    output = nav_obj.get_dir_tree_json(start_dir_path=start_dir)
    return JsonResponse(output)
示例#14
0
 def __init__(self, data_file, ref_data_file):
     self.data_file = data_file
     self.data = read_xml_get_json(data_file)
     self.ref_data_file = ref_data_file
     self.nav_obj = Navigator()
     self.dependency_template = join_path(self.nav_obj.get_katana_dir(),
                                          "native", "settings", "static",
                                          "settings", "base_templates",
                                          "empty.xml")
     self.ref_data = self._get_ref_data()
     self.dependency_dict = self.__get_dependency_dict()
示例#15
0
 def __add_app_directory(self):
     temp_app_path = join_path(self.app_directory, self.app_name)
     if os.path.exists(temp_app_path):
         output = False
         message = "-- An Error Occurred -- Directory already exists: {0}.".format(
             temp_app_path)
         print(message)
         self.message += message
     else:
         output = copy_dir(self.path_to_app, temp_app_path)
         self.delete_app_dir.append(self.path_to_app)
     return output
示例#16
0
class CliDataFileClass(View):
    nav_obj = Navigator()
    app_directory = join_path(nav_obj.get_katana_dir(), "wapps", "cli_data")
    app_static_dir = join_path(app_directory, "static")

    def get(self, request):
        filepath = request.GET.get('path')
        # filepath = join_path(CliDataFileClass.app_static_dir, "base_templates", "test.xml")
        base_filepath = join_path(CliDataFileClass.app_static_dir,
                                  "base_templates", "empty.xml")
        if filepath == "false":
            filepath = base_filepath
            name = "Untitled"
        else:
            name, _ = os.path.splitext(get_dir_from_path(filepath))
        vcdc_obj = VerifyCliDataClass(filepath, base_filepath)
        json_data = vcdc_obj.verify_contents()
        return JsonResponse({
            "contents": json_data,
            "name": name,
            "filepath": get_parent_dir_path(filepath)
        })

    def post(self, request):
        json_data = json.loads(request.POST.get('json_data'))
        data = xmltodict.unparse(json_data)
        directory = request.POST.get('directory')
        filepath = os.path.join(directory,
                                request.POST.get('filename') + ".xml")
        message = ""
        saved = True
        try:
            with open(filepath, 'w') as f:
                f.write(data)
        except Exception as e:
            saved = False
            message = e
        return JsonResponse({"saved": saved, "message": message})
示例#17
0
 def __add_plugins(self):
     output = True
     for plugin in self.plugins_paths:
         if output:
             plugin_name = get_dir_from_path(plugin)
             temp_pl_path = join_path(self.plugin_directory, plugin_name)
             if os.path.exists(temp_pl_path):
                 output = False
                 message = "-- An Error Occurred -- Directory already exists: {0}.".format(
                     temp_pl_path)
                 print(message)
                 self.message += message
             else:
                 output = copy_dir(plugin, temp_pl_path)
                 self.delete_plugins_dir.append(plugin)
     return output
 def set_apps(self, data):
     """ call this to build Apps array and make app objects """
     self.get_config_paths(data)
     for url in self.paths:
         json_data = read_json_data(url)
         if json_data is not None:
             app_path = get_parent_directory(url)
             app = App(json_data, app_path, data["base_directory"])
             js_urls = get_paths_of_subfiles(
                 join_path(app_path, app.static_file_dir, "js"),
                 extension=compile_regex("^\.js$"))
             for i in range(0, len(js_urls)):
                 js_urls[i] = get_relative_path(js_urls[i], app_path)
             app.data["js_urls"] = js_urls
             self.apps.append(app)
     return self.apps
示例#19
0
 def get(self, request):
     filepath = request.GET.get('path')
     # filepath = join_path(CliDataFileClass.app_static_dir, "base_templates", "test.xml")
     base_filepath = join_path(CliDataFileClass.app_static_dir,
                               "base_templates", "empty.xml")
     if filepath == "false":
         filepath = base_filepath
         name = "Untitled"
     else:
         name, _ = os.path.splitext(get_dir_from_path(filepath))
     vcdc_obj = VerifyCliDataClass(filepath, base_filepath)
     json_data = vcdc_obj.verify_contents()
     return JsonResponse({
         "contents": json_data,
         "name": name,
         "filepath": get_parent_dir_path(filepath)
     })
示例#20
0
 def _get_package_list(self, driver_path):
     """ This function gets the list of packages included in each driver """
     with open(driver_path, 'r') as f:
         data = f.readlines()
     list_of_pkgs = []
     package_list = []
     for line in data:
         if line.strip().startswith('package_list'):
             temp = line.split("[")[1].strip()[:-1]
             list_of_pkgs = [x.strip() for x in temp.split(",")]
             break
     for pkg in list_of_pkgs:
         temp = pkg.split(".")
         path = self.warrior_dir
         for i in range(0, len(temp)):
             path = join_path(path, temp[i])
         package_list.append(path)
     return package_list
示例#21
0
def validate_config_json(json_data, warrior_dir):
    """
    This function validates the config.json file and returns an ordered dictionary

    :param json_data: original unordered contents of config.json
    :param warrior_dir: path to warrior directory

    :return: Ordered Dictionary containing validated config.json data
    """
    ordered_json = OrderedDict()
    if "engineer" not in json_data:
        ordered_json["engineer"] = ""
    else:
        ordered_json["engineer"] = json_data["engineer"]

    ordered_json["pythonsrcdir"] = warrior_dir[:-1] \
        if "pythonsrcdir" not in json_data or json_data["pythonsrcdir"] == "" \
        else json_data["pythonsrcdir"]

    warrior_dir = ordered_json["pythonsrcdir"]
    ref = OrderedDict([("xmldir", "Testcases"), ('testsuitedir', 'Suites'),
                       ('projdir', 'Projects'), ('idfdir', 'Data'),
                       ('testdata', 'Config_files')])

    for key, value in list(ref.items()):
        if key not in json_data or json_data[key] == "":
            path = get_abs_path(join_path("Warriorspace", value), warrior_dir)
            if path is not None:
                ordered_json[key] = path
            else:
                ordered_json[key] = ""
                print(
                    "-- An Error Occurred -- Path to {0} directory could not be located"
                    .format(value))
        else:
            ordered_json[key] = json_data[key]

    if "pythonpath" not in json_data:
        ordered_json["pythonpath"] = ""
    else:
        ordered_json["pythonpath"] = json_data["pythonpath"]

    return ordered_json
示例#22
0
def save_file(request):
    """ This function saves the file in the given path. """
    output = {"status": True, "message": ""}
    data = json.loads(request.POST.get("data"), object_pairs_hook=collections.OrderedDict)
    data["TestWrapper"]["Details"] = validate_details_data(data["TestWrapper"]["Details"])
    data["TestWrapper"]["Setup"]["step"] = validate_step_data(data["TestWrapper"]["Setup"]["step"])
    data["TestWrapper"]["Cleanup"]["step"] = validate_step_data(data["TestWrapper"]["Cleanup"]["step"])
    data["TestWrapper"]["Debug"]["step"] = validate_step_data(data["TestWrapper"]["Debug"]["step"])
    xml_data = xmltodict.unparse(data, pretty=True)
    directory = request.POST.get("directory")
    filename = request.POST.get("filename")
    extension = request.POST.get("extension")
    try:
        with open(join_path(directory, filename + extension), 'w') as f:
            f.write(xml_data)
    except Exception as e:
        output["status"] = False
        output["message"] = e
        print("-- An Error Occurred -- {0}".format(e))
    return JsonResponse(output)
示例#23
0
class WappManagementView(View):

    template = 'wapp_management/wapp_management.html'
    dot_data_directory = join_path(nav_obj.get_katana_dir(), "native",
                                   "wapp_management", ".data")

    def get(self, request):
        """
        Get Request Method
        """
        files = get_sub_files(WappManagementView.dot_data_directory)
        preferences = []
        for subfile in files:
            filename, file_extension = os.path.splitext(subfile)
            if file_extension == ".xml":
                preferences.append(filename)
        output = {
            "data": {
                "app": AppInformation.information.apps,
                "preferences": preferences
            }
        }
        return render(request, WappManagementView.template, output)
示例#24
0
 def __verify_app_details(self, app_details):
     output = {"status": True, "message": ""}
     if "name" not in app_details or "url" not in app_details or "include" not in app_details:
         print(
             "-- An Error Occurred -- wf_config.json file is not in the correct format."
         )
         output["status"] = False
     else:
         self.urls_inclusions.append("url(r'^" + app_details["url"] +
                                     "', include('" +
                                     app_details["include"] + "')),")
         path_dir = app_details["include"].split(".")
         path_urls = ""
         for d in range(2, len(path_dir)):
             path_urls += os.sep + path_dir[d]
         path_urls = path_urls.strip(os.sep)
         path_urls += ".py"
         path_to_urls_abs = join_path(self.path_to_app, path_urls)
         if not os.path.isfile(path_to_urls_abs):
             output["status"] = False
             output["message"] = "Package {0} does not exist.".format(
                 app_details["include"])
             print("-- An Error Occurred -- {0}".format(output["message"]))
     return output
 def __init__(self, base_directory, app_path, app_type):
     self.app_name = get_dir_from_path(app_path)
     self.base_directory = base_directory
     self.plugin_dir = join_path(self.base_directory, "warrior", "plugins")
     self.app_dir = join_path(self.base_directory, "katana", app_type)
     self.settings_file = join_path(self.base_directory, "katana", "wui",
                                    "settings.py")
     self.urls_file = join_path(self.base_directory, "katana", "wui",
                                "urls.py")
     self.app_path = get_abs_path(self.app_name, self.app_dir)
     self.app_type = app_type
     self.config_file = join_path(self.app_path, "wf_config.json")
     self.config_file_data = read_json_data(self.config_file)
     self.related_plugins = self.__extract_plugin_names()
     self.pkg_in_settings = self.__get_setting_file_info()
     self.include_urls = self.__get_urls_info()
     self.valid_app_types = {"wapps"}
     self.cache_dir = create_dir(
         join_path(self.base_directory, "katana", ".data", self.app_name))
     self.settings_backup = []
     self.urls_backup = []
示例#26
0
    def run_process(os_string):
        return subprocess.Popen(os_string.split(), shell=False, stdin=None, stdout=None, stderr=None, close_fds=True)

    def to_string(self, args):
        args[0] = self.manage_path
        if len(args) > 1 and args[1] == 'database':
            args.remove('database')
        return 'python3 ' + ' '.join(args)

    def katana_init(self, args):
        args[0] = self.manage_path
        self.og_process = self.run_process(self.to_string(args))
        signal.signal(signal.SIGINT, self.signal_handler)
        if len(args) > 1 and args[1] == 'database':
            self.database_init()
        signal.pause()

    def database_init(self):
        proc = self.run_process('python3 {0} makemigrations'.format(self.manage_path))
        proc.wait()
        proc = self.run_process('python3 {0} migrate --run-syncdb'.format(self.manage_path))
        proc.wait()


if __name__ == "__main__":
    if not use_py_server:
        katana = Katana(join_path(get_parent_dir_path(sys.argv[0]), "manage.py"))
        katana.katana_init(sys.argv)
    else:
        main('8000')
示例#27
0
 def __init__(self, warrior_dir):
     """Constructor for GetDriversActions Class"""
     self.warrior_dir = warrior_dir
     self.actions_dir = join_path(self.warrior_dir, "Actions")
     self.pd_dir = join_path(self.warrior_dir, "ProductDrivers")
     self.information = self._get_drivers()
示例#28
0
from django.views import View
import collections
import json
import os
import xmltodict
from django.http import JsonResponse
from django.template.loader import render_to_string
from utils.directory_traversal_utils import join_path, get_parent_dir_path, get_dir_from_path
from utils.json_utils import read_json_data, read_xml_get_json
from utils.navigator_util import Navigator
from wapps.suites.suite_utils.defaults import on_errors, impacts, contexts, runmodes, \
    executiontypes, runtypes
from wapps.suites.suite_utils.verify_suite_file import VerifySuiteFile

navigator = Navigator()
CONFIG_FILE = join_path(navigator.get_katana_dir(), "config.json")
APP_DIR = join_path(navigator.get_katana_dir(), "wapps", "suites")
STATIC_DIR = join_path(APP_DIR, "static", "suites")
TEMPLATE = join_path(STATIC_DIR, "base_templates", "Untitled.xml")
DROPDOWN_DEFAULTS = read_json_data(
    join_path(STATIC_DIR, "base_templates", "dropdowns_data.json"))


class SuitesView(View):
    def get(self, request):
        """
        Get Request Method
        """
        return render(request, 'suites/suites.html')

 def __init__(self):
     self.navigator = Navigator()
     self.static_dir = join_path(self.navigator.get_katana_dir(), "native",
                                 "settings", "static", "settings")
示例#30
0
import os
import xmltodict
from django.http import JsonResponse
from django.shortcuts import render
from django.template.loader import render_to_string
from django.views import View
from utils.directory_traversal_utils import join_path, get_dir_from_path, get_parent_dir_path
from utils.json_utils import read_json_data
from utils.navigator_util import Navigator
from wapps.testwrapper.testwrapper_utils.defaults import impacts, on_errors, runmodes, iteration_types, contexts
from wapps.testwrapper.testwrapper_utils.get_drivers import GetDriversActions
from wapps.testwrapper.testwrapper_utils.verify_testwrapper_file import VerifyTestWrapperFile

navigator = Navigator()
CONFIG_FILE = join_path(navigator.get_katana_dir(), "config.json")
APP_DIR = join_path(navigator.get_katana_dir(), "wapps", "testwrapper")
STATIC_DIR = join_path(APP_DIR, "static", "testwrapper")
TEMPLATE = join_path(STATIC_DIR, "base_templates", "Untitled.xml")
DROPDOWN_DEFAULTS = read_json_data(join_path(STATIC_DIR, "base_templates", "dropdowns_data.json"))


clas TestWrapperView(View):

    def get(self, request):
        """
        Get Request Method
        """
        return render(request, 'testwrapper/cases.html')