Skip to content

Commit

Permalink
💥 重命名项目名为httpfpt (#12)
Browse files Browse the repository at this point in the history
* Rename the project to httpfpt

* 修正错别字
  • Loading branch information
wu-clan authored Jun 11, 2023
1 parent f1fd093 commit 6756d08
Show file tree
Hide file tree
Showing 82 changed files with 161 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# - name: check GITHUB_REF matches package version
# uses: samuelcolvin/[email protected]
# with:
# version_file_path: fastpt/__init__.py
# version_file_path: httpfpt/__init__.py
lint:
runs-on: ubuntu-latest
name: lint
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ dmypy.json
.pyre/

# test report
fastpt/report/
fastpt/log/
httpfpt/report/
httpfpt/log/

# idea
.idea/

# online case data
fastpt/data/online/
httpfpt/data/online/

# ruff
fastpt/.ruff_cache/
httpfpt/.ruff_cache/
10 changes: 5 additions & 5 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ ignore = ["F401"]
line-length = 120
format = "grouped"
target-version = "py38"
cache-dir = "./fastpt/.ruff_cache"
extend-exclude = ["fastpt/conftest.py"]
cache-dir = "./httpfpt/.ruff_cache"
extend-exclude = ["httpfpt/conftest.py"]

[flake8-pytest-style]
mark-parentheses = false
Expand All @@ -47,6 +47,6 @@ order-by-type = true
mypy-init-return = true

[per-file-ignores]
"fastpt/test_case/test_*.py" = ["ANN001", "ANN201"]
"fastpt/conftest.py" = ["ANN001", "ANN201"]
"fastpt/cli.py" = ["E402"]
"httpfpt/test_case/test_*.py" = ["ANN001", "ANN201"]
"httpfpt/conftest.py" = ["ANN001", "ANN201", "ANN202"]
"httpfpt/cli.py" = ["E402"]
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Automated Api Pytest
# HttpFpt

基于数据驱动的接口自动化测试框架

Http: http 请求,

F:fast,

pt:pytest

## 功能点

- 多项目分级,自由切换,互不干扰
Expand All @@ -20,14 +26,14 @@

## 帮助

有关更多详细信息,请参阅 [文档](https://wu-clan.github.io/automated_api_pytest_docs)

有关更多详细信息,请参阅 [文档](https://wu-clan.github.io/httpfpt_docs)

## 贡献

欢迎加入,如果你有好的想法,可以提 issue 或者 pr
欢迎加入,如果你有好的想法,可以提交 issues 或 pr

对于 PR:

1. Fork 仓库
2. git clone 你的仓库
3. 创建虚拟环境 `python3 -m venv venv`
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions fastpt/cli.py → httpfpt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

sys.path.append('..')

from fastpt.common.yaml_handler import read_yaml
from fastpt.schemas.case_data import CaseData
from fastpt.utils.file_control import search_all_case_yaml_files
from fastpt.utils.case_auto_generator import auto_generate_test_cases
from fastpt.utils.data_manage.openapi import SwaggerParser
from fastpt.utils.data_manage.apifox import ApiFoxParser
from fastpt.utils.data_manage.git_repo import GitRepoPaser
from httpfpt.common.yaml_handler import read_yaml
from httpfpt.schemas.case_data import CaseData
from httpfpt.utils.file_control import search_all_case_yaml_files
from httpfpt.utils.case_auto_generator import auto_generate_test_cases
from httpfpt.utils.data_manage.openapi import SwaggerParser
from httpfpt.utils.data_manage.apifox import ApiFoxParser
from httpfpt.utils.data_manage.git_repo import GitRepoPaser

app = typer.Typer(rich_markup_mode='rich')

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import dotenv

from fastpt.common.log import log
from httpfpt.common.log import log


def get_env_dict(filepath: str) -> dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import xlrd

from fastpt.common.log import log
from httpfpt.common.log import log


def read_excel(filepath: str, *, filename: str, sheet: str = 'Sheet1') -> List[Dict[str, Optional[Any]]]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from typing import Optional, NoReturn, Any

from fastpt.common.log import log
from httpfpt.common.log import log


def read_json_file(filepath: Optional[str] = None, *, filename: str, **kwargs) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion fastpt/common/log.py → httpfpt/common/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from loguru import logger

from fastpt.core.path_conf import LOG_PATH
from httpfpt.core.path_conf import LOG_PATH

if TYPE_CHECKING:
import loguru
Expand Down
26 changes: 13 additions & 13 deletions fastpt/common/send_request.py → httpfpt/common/send_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
from httpx import Response as HttpxResponse
from requests import Response as RequestsResponse

from fastpt.common.log import log
from fastpt.core import get_conf
from fastpt.db.mysql_db import MysqlDB
from fastpt.enums.request.body import BodyType
from fastpt.enums.request.engin import EnginType
from fastpt.utils.allure_control import allure_attach_file, allure_step
from fastpt.utils.assert_control import Asserter
from fastpt.utils.enum_control import get_enum_values
from fastpt.utils.relate_testcase_executor import exec_setup_testcase
from fastpt.utils.request.hooks_executor import HookExecutor
from fastpt.utils.request.request_data_parse import RequestDataParse
from fastpt.utils.request.vars_extractor import VarsExtractor
from fastpt.utils.time_control import get_current_time
from httpfpt.common.log import log
from httpfpt.core import get_conf
from httpfpt.db.mysql_db import MysqlDB
from httpfpt.enums.request.body import BodyType
from httpfpt.enums.request.engin import EnginType
from httpfpt.utils.allure_control import allure_attach_file, allure_step
from httpfpt.utils.assert_control import Asserter
from httpfpt.utils.enum_control import get_enum_values
from httpfpt.utils.relate_testcase_executor import exec_setup_testcase
from httpfpt.utils.request.hooks_executor import HookExecutor
from httpfpt.utils.request.request_data_parse import RequestDataParse
from httpfpt.utils.request.vars_extractor import VarsExtractor
from httpfpt.utils.time_control import get_current_time


class SendRequests:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import rtoml

from fastpt.common.log import log
from httpfpt.common.log import log


def read_toml(filepath: str, filename: str, encoding: str = 'utf-8') -> dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from cache3 import SafeCache

from fastpt.common.log import log
from httpfpt.common.log import log


class VariableCache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import yaml

from fastpt.common.log import log
from fastpt.core.path_conf import YAML_DATA_PATH, YAML_REPORT_PATH, TEST_DATA_PATH
from httpfpt.common.log import log
from httpfpt.core.path_conf import YAML_DATA_PATH, YAML_REPORT_PATH, TEST_DATA_PATH


def read_yaml(
Expand Down
8 changes: 4 additions & 4 deletions fastpt/conftest.py → httpfpt/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from filelock import FileLock
from py._xmlgen import html

from fastpt.common.log import log
from fastpt.common.variable_cache import VariableCache
from fastpt.common.yaml_handler import write_yaml_report
from fastpt.core.get_conf import TESTER_NAME, PROJECT_NAME, TEST_REPORT_TITLE
from httpfpt.common.log import log
from httpfpt.common.variable_cache import VariableCache
from httpfpt.common.yaml_handler import write_yaml_report
from httpfpt.core.get_conf import TESTER_NAME, PROJECT_NAME, TEST_REPORT_TITLE


@pytest.fixture(scope='session', autouse=True)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion fastpt/core/get_conf.py → httpfpt/core/get_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from pathlib import Path

from fastpt.common.toml_handler import read_toml
from httpfpt.common.toml_handler import read_toml

__config = read_toml(str(Path(__file__).resolve().parent), 'conf.toml')

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions fastpt/db/mysql_db.py → httpfpt/db/mysql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from dbutils.pooled_db import PooledDB
from jsonpath import jsonpath

from fastpt.common.env_handler import write_env_vars
from fastpt.common.log import log
from fastpt.common.variable_cache import VariableCache
from fastpt.common.yaml_handler import write_yaml_vars
from fastpt.core import get_conf
from fastpt.core.path_conf import RUN_ENV_PATH
from fastpt.enums.sql_type import SqlType
from fastpt.enums.var_type import VarType
from fastpt.utils.enum_control import get_enum_values
from httpfpt.common.env_handler import write_env_vars
from httpfpt.common.log import log
from httpfpt.common.variable_cache import VariableCache
from httpfpt.common.yaml_handler import write_yaml_vars
from httpfpt.core import get_conf
from httpfpt.core.path_conf import RUN_ENV_PATH
from httpfpt.enums.sql_type import SqlType
from httpfpt.enums.var_type import VarType
from httpfpt.utils.enum_control import get_enum_values


class MysqlDB:
Expand Down
4 changes: 2 additions & 2 deletions fastpt/db/redis_db.py → httpfpt/db/redis_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from redis import Redis, AuthenticationError

from fastpt.common.log import log
from fastpt.core import get_conf
from httpfpt.common.log import log
from httpfpt.core import get_conf


class RedisDB:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions fastpt/run.py → httpfpt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@

import pytest

from fastpt.common.yaml_handler import read_yaml
from fastpt.core.get_conf import PROJECT_NAME, EMAIL_REPORT_SEND, DING_TALK_REPORT_SEND, LARK_TALK_REPORT_SEND
from fastpt.core.path_conf import (
from httpfpt.common.yaml_handler import read_yaml
from httpfpt.core.get_conf import PROJECT_NAME, EMAIL_REPORT_SEND, DING_TALK_REPORT_SEND, LARK_TALK_REPORT_SEND
from httpfpt.core.path_conf import (
HTML_REPORT_PATH,
ALLURE_REPORT_PATH,
ALLURE_ENV_FILE,
ALLURE_REPORT_ENV_FILE,
ALLURE_REPORT_HTML_PATH,
YAML_REPORT_PATH,
)
from fastpt.db.redis_db import RedisDB
from fastpt.utils.relate_testcase_executor import get_all_testcase_id, get_all_testcase_data
from fastpt.utils.send_report.ding_talk import DingTalk
from fastpt.utils.send_report.lark_talk import LarkTalk
from fastpt.utils.send_report.send_email import SendMail
from httpfpt.db.redis_db import RedisDB
from httpfpt.utils.relate_testcase_executor import get_all_testcase_id, get_all_testcase_data
from httpfpt.utils.send_report.ding_talk import DingTalk
from httpfpt.utils.send_report.lark_talk import LarkTalk
from httpfpt.utils.send_report.send_email import SendMail


def run(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from dirty_equals import IsInt

from fastpt.common.log import log
from httpfpt.common.log import log


@allure.epic('demo')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import allure
import pytest

from fastpt.common.send_request import send_request
from fastpt.common.yaml_handler import read_yaml
from fastpt.core.get_conf import PROJECT_NAME
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids
from httpfpt.common.send_request import send_request
from httpfpt.common.yaml_handler import read_yaml
from httpfpt.core.get_conf import PROJECT_NAME
from httpfpt.utils.request.case_data_file_parse import get_request_data
from httpfpt.utils.request.ids_extract import get_ids

request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, 'api_test_case_template.yaml'])), use_pydantic_verify=True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import allure
import pytest

from fastpt.common.send_request import send_request
from fastpt.common.yaml_handler import read_yaml
from fastpt.core.get_conf import PROJECT_NAME
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids
from httpfpt.common.send_request import send_request
from httpfpt.common.yaml_handler import read_yaml
from httpfpt.core.get_conf import PROJECT_NAME
from httpfpt.utils.request.case_data_file_parse import get_request_data
from httpfpt.utils.request.ids_extract import get_ids

request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, 'only_skip.yml'])), use_pydantic_verify=False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import allure
import pytest

from fastpt.common.send_request import send_request
from fastpt.common.yaml_handler import read_yaml
from fastpt.core.get_conf import PROJECT_NAME
from fastpt.utils.request.case_data_file_parse import get_request_data
from fastpt.utils.request.ids_extract import get_ids
from httpfpt.common.send_request import send_request
from httpfpt.common.yaml_handler import read_yaml
from httpfpt.core.get_conf import PROJECT_NAME
from httpfpt.utils.request.case_data_file_parse import get_request_data
from httpfpt.utils.request.ids_extract import get_ids

request_data = get_request_data(
file_data=read_yaml(filename=os.sep.join([PROJECT_NAME, 'upload_file.yaml'])), use_pydantic_verify=True
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import allure
from allure_commons.types import AttachmentType

from fastpt.utils.file_control import get_file_property
from httpfpt.utils.file_control import get_file_property


def allure_step(step: str, var: Union[str, dict]) -> NoReturn:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from jsonpath import jsonpath

from fastpt.common.log import log
from fastpt.db.mysql_db import MysqlDB
from fastpt.enums.assert_type import AssertType
from httpfpt.common.log import log
from httpfpt.db.mysql_db import MysqlDB
from httpfpt.enums.assert_type import AssertType


class Asserter:
Expand Down Expand Up @@ -50,7 +50,7 @@ def _code_asserter(self, response: dict, assert_text: str) -> NoReturn:
1. assert 200 == pm.response.get('status_code')
2. assert 'success' != pm.response.get('msg')[1]
3. assert 'com' in pm.response.get('content').get('url')
4. assert pm.response.get('header').get('fastpt') == IsDict(version=0.0.1)
4. assert pm.response.get('header').get('httpfpt') == IsDict(version=0.0.1)
5. assert pm.response.get('content').get('id') == IsUUID
:param response:
Expand Down
10 changes: 5 additions & 5 deletions fastpt/utils/auth_plugins.py → httpfpt/utils/auth_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import requests
from jsonpath import jsonpath

from fastpt.common.yaml_handler import read_yaml
from fastpt.core.path_conf import AUTH_CONF_PATH
from fastpt.db.redis_db import RedisDB
from fastpt.enums.request.auth import AuthType
from fastpt.utils.enum_control import get_enum_values
from httpfpt.common.yaml_handler import read_yaml
from httpfpt.core.path_conf import AUTH_CONF_PATH
from httpfpt.db.redis_db import RedisDB
from httpfpt.enums.request.auth import AuthType
from httpfpt.utils.enum_control import get_enum_values

auth_data = read_yaml(AUTH_CONF_PATH, filename='auth.yaml')
IS_AUTH = auth_data['is_auth']
Expand Down
Loading

0 comments on commit 6756d08

Please sign in to comment.