Package: kittymocklib-py
kitty Mock Lib PythonA Python library for simulate an API with http and websocket request. In this0.1.1.4version of kitty-Mock-Lib-Python, allows you to simulate an API, being able to create routes in your own way, getting the history, details of it and other things you can do.InstallationThe latest stable versionis available on PyPI. Either addkittymocklib_pyto yourrequirements.txtfile or install with pip:pip install kittymocklib-pyDescriptionThis project aims to help other types of projects that need a python API simulation and with this lib, you can simulate both http and websocket.StartingTo run the project, you will need to install the following programs:Python: Required to create the projectDocker: Required to create the containersVS Code: For project developmentStepsStep 0:In this lib we use a docker image from kitty Mock, so for you to use it you will have to create adocker-compose.ymlfile in order to take advantage of this lib:version: "3"
services:
  kittymock1:
    image: ntopus/kitty-mock:0.4.5
    ports:
      - "6999:6999"
      - "7000-7020:7000-7020"
    environment:
      SERVER_PORT: 6999
      MOCKER_PORTS_RANGE: 7000-7020In order to run the docker, first you have tobuildand then upload the container.docker-compose buildLater:docker-compose upOr can run this way:docker-compose up --build
          or
docker-compose up --build -dexamples of how to use:How to useFirst stepsHttp routeCreate the mockerfrom kittymocklib_py.mocker import Mocker

def create_mocker():
    mocker = Mocker("http://localhost", 6999)
    print(f'My port: {mocker.mocker_port}')Create http mock routefrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    route = mocker.create_http_route("/hello", "GET", 200, "hello my friend")Request http mock routefrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    route = mocker.create_http_route("/hello", "GET", 200, "hello my friend")
    route_response = route.request()Delete mocker serverfrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    response = mocker.delete()Delete http mock routefrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    route = mocker.create_http_route("/hello", "GET", 200, "hello my friend")
    route_response = route.delete()Get history http mock routefrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    route = mocker.create_http_route("/hello", "GET", 200, "hello my friend")
    route_response = route.get_history()Clear history http mock routefrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    route = mocker.create_http_route("/hello", "GET", 200, "hello my friend")
    route_response = route.clear_history()Details http mock routefrom kittymocklib_py.mocker import Mocker

def create_http_mock_route():
    mocker = Mocker("http://localhost", 6999)
    route = mocker.create_http_route("/hello", "GET", 200, "hello my friend")
    route_response = route.details()WebSocketUnavailable in this versionTestIn this lib, functional tests were used, with it we can run it like this:python -m unittest discover tests -vAdditionalIn this lib we use loggings, to be able to know everything that is going on behind the scenes, as well as to know if there was any error or bug somewhere in the code, it will demonstrate for youConfigurationTo execute the project, it is necessary to use VsCode or an IDE of your preference, so that it identifies the dependencies necessary for execution in the repository. Once the project is imported, it will be possible to test its functionality in real time.ContributionsContributions are always welcome! I hope I have helped someone in need.🔓 LicenseMIT ©Evandro Silva