Skip to content

Commit

Permalink
🧪 test: Added a test for Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
xitowzys committed May 11, 2023
1 parent eaf65b9 commit f8e866b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 7 deletions.
6 changes: 3 additions & 3 deletions raw/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions tests/domain/usecases/test_delete_tmp_models_files_usecase.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/domain/usecases/test_update_open_api_schema_usecase.py

This file was deleted.

53 changes: 53 additions & 0 deletions tests/test_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os
from pprint import pprint

from fastapi_gateway_auto_generate import Generator, Config
from fastapi import FastAPI
from fastapi.testclient import TestClient
import json

from tests.builders.FakeServices import FakeServices


def test_generator():
app = FastAPI()

config = Config(
fast_api_app=app,
db_path="./tmp/"
)

autoRG = Generator(
config=config
)

client = TestClient(app)

fake_service = FakeServices().with_domain().with_name().with_port().build()

payload = {
"domain": fake_service["domain"],
"name_service": fake_service["name"],
"port": fake_service["port"]
}

client.post("/service", content=json.dumps(payload))

client.get("/services", params={"page": 1})

responses = client.delete("/service", params={"id_service": 1})

client.patch("/services")

#
# params = {
# "id": 0
# }
#
# response = client.delete("/service", params=params)

pprint(responses.text)
os.remove(config.get_database_absolute_path())

# if __name__ == "__main__":
# uvicorn.run(app=app, port=5000, log_level="info")

0 comments on commit f8e866b

Please sign in to comment.