コード例 #1
0
    def __init__(self, parent_view):
        self.current: ApiCall = None
        self.current_exchange: HttpExchange = None
        self.view = parent_view
        self.view.txt_raw_request.document().setDefaultStyleSheet(pyg_styles())
        self.view.txt_raw_response.document().setDefaultStyleSheet(
            pyg_styles())

        self.view.txt_exchange_request_body.document().setDefaultStyleSheet(
            pyg_styles())
        self.view.txt_response_body.document().setDefaultStyleSheet(
            pyg_styles())

        self.view.tbl_exchange_request_headers.header().setSectionResizeMode(
            0, QHeaderView.Stretch)
        self.view.tbl_exchange_request_headers.header().setSectionResizeMode(
            1, QHeaderView.Stretch)
        self.view.tbl_exchange_request_params.header().setSectionResizeMode(
            0, QHeaderView.Stretch)
        self.view.tbl_exchange_request_params.header().setSectionResizeMode(
            1, QHeaderView.Stretch)
        self.view.tbl_exchange_form_params.header().setSectionResizeMode(
            0, QHeaderView.Stretch)
        self.view.tbl_exchange_form_params.header().setSectionResizeMode(
            1, QHeaderView.Stretch)
        self.view.tbl_response_headers.header().setSectionResizeMode(
            0, QHeaderView.Stretch)
        self.view.tbl_response_headers.header().setSectionResizeMode(
            1, QHeaderView.Stretch)

        # ui events
        self.view.btn_share_preview.clicked.connect(self.open_share_preview)

        # domain events
        app_settings.app_data_writer.signals.exchange_added.connect(
            self.refresh)
        app_settings.app_data_reader.signals.api_call_change_selection.connect(
            self.display_last_exchange)
        app_settings.app_data_writer.signals.selected_exchange_changed.connect(
            self.on_exchange_changed)
コード例 #2
0
    def __init__(self, parent_view):
        self.current = None
        self.view = parent_view

        self.request_header_list_presenter = KeyValueListPresenter(
            self.view.lst_request_headers,
            self,
            key_completions=COMMON_HEADERS,
            value_completions=HTTP_CONTENT_TYPES,
        )
        self.request_param_list_presenter = KeyValueListPresenter(
            self.view.lst_request_params, self)
        self.form_params_list_presenter = KeyValueListPresenter(
            self.view.lst_form_params, self)

        self.mocked_response_presenter = MockedResponsePresenter(
            self, self.view)

        self.view.txt_request_body.document().setDefaultStyleSheet(
            pyg_styles())

        self.assertion_builder_dialog = AssertionBuilderDialog(self.view)
        self.txt_new_tag_input = NewTagEntryLineEdit(self.view)
        self.view.tags_layout.addWidget(self.txt_new_tag_input)
        self.spacer_item = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                       QSizePolicy.Minimum)
        self.view.tags_layout.addItem(self.spacer_item)
        self.view.btn_send_request.pressed.connect(self.on_btn_send_request)
        self.view.btn_add_tag.pressed.connect(self.add_new_tag_label)
        self.txt_new_tag_input.save_tag_signal.connect(self.save_new_tag)
        self.txt_new_tag_input.discard_tag_signal.connect(self.discard_new_tag)
        self.view.btn_open_assertions_dialog.pressed.connect(
            self.on_show_assertions_dialog)

        app_settings.app_data_reader.signals.api_call_change_selection.connect(
            self.refresh)
        app_settings.app_data_writer.signals.api_call_tag_added.connect(
            self.refresh)
        app_settings.app_data_writer.signals.api_call_tag_removed.connect(
            self.refresh)
        app_settings.app_data_writer.signals.api_call_updated.connect(
            self.on_api_call_refresh)
        app_settings.app_data_writer.signals.api_test_case_changed.connect(
            self.refresh_completer)
        app_settings.app_data_writer.signals.environment_data_changed.connect(
            self.refresh_completer)
        app_settings.app_data_reader.signals.initial_cache_loading_completed.connect(
            self.refresh_completer)
        app_settings.app_data_writer.signals.exchange_added.connect(
            self.on_exchange_added)

        self.assertion_result_presenter = AssertionResultPresenter(self.view)
コード例 #3
0
    def __init__(self, view, parent=None):
        self.view = view
        self.main_window = parent
        self.selected_api: ApiCall = None
        self.view.txt_fuzz_output.document().setDefaultStyleSheet(pyg_styles())
        self.__clear_results()

        # ui events
        self.view.btn_fuzz_test.clicked.connect(self.on_fuzz_test)

        # domain events
        app_settings.app_data_reader.signals.api_call_change_selection.connect(
            self.__on_updated_selected_api
        )
コード例 #4
0
    def __init__(self, view, parent=None):
        self.view = view
        self.main_window = parent
        self.mode = DisplayMode.SINGLE_API
        self.selected_api: ApiCall = None
        self.view.txt_generated_code.document().setDefaultStyleSheet(
            pyg_styles())

        self.view.cmb_exporters.currentIndexChanged[int].connect(
            self.on_exporter_change)
        self.view.btn_copy_code.pressed.connect(self.on_copy_clipboard)
        self.view.btn_export_code.pressed.connect(self.on_export_file)

        app_settings.app_data_reader.signals.api_call_change_selection.connect(
            self.on_updated_selected_api)
コード例 #5
0
    def __init__(self, parent, parent_view):
        self.parent_presenter = parent
        self.parent_view = parent_view

        self.mocked_response_headers_presenter = KeyValueListPresenter(
            self.parent_view.lst_mocked_response_headers,
            self,
            key_completions=COMMON_HEADERS,
            value_completions=HTTP_CONTENT_TYPES,
        )

        self.parent_view.txt_mocked_response_body.document(
        ).setDefaultStyleSheet(pyg_styles())

        app_settings.app_data_reader.signals.initial_cache_loading_completed.connect(
            self.refresh_completer)
        app_settings.app_data_writer.signals.api_test_case_changed.connect(
            self.refresh_completer)
        app_settings.app_data_writer.signals.environment_data_changed.connect(
            self.refresh_completer)
コード例 #6
0
    def __init__(self, view, parent=None):
        self.view = view
        self.main_window = parent
        self.selected_exchanges = None
        self.edit_view = True
        self.md_content = ""
        self.share_service_interactor = ShareServiceInteractor(self.view)

        self.view.txt_preview_share.document().setDefaultStyleSheet(
            pyg_styles())

        # ui events
        self.view.btn_show_preview.clicked.connect(self.render_preview)
        self.view.btn_share_exchange.clicked.connect(self.share_exchange)

        # domain events
        app_settings.app_data_writer.signals.exchange_share_created.connect(
            self.on_share_created)
        app_settings.app_data_writer.signals.exchange_share_failed.connect(
            self.on_share_failed)