Skip to content

Commit

Permalink
fix tests (#416)
Browse files Browse the repository at this point in the history
- fix tests
  • Loading branch information
devkral authored Oct 21, 2024
1 parent 5094593 commit 6d32153
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions tests/cli/simple/test_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,20 @@ def test_list_directives_with_app(create_folders):


def test_list_directives_with_flag(create_folders):
original_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
cli_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
run_cmd("tests.cli.main:app", "lilya createproject myproject")

os.chdir(original_path)
os.makedirs("myproject/myproject/apps/myapp/directives/operations/")
os.chdir(cli_path)
os.makedirs("myproject/myproject/apps/myapp/directives/operations/", exist_ok=True)

shutil.copyfile(
"createsuperuser.py",
"myproject/myproject/apps/myapp/directives/operations/createsuperuser.py",
)

# switch to the base directory
os.chdir(os.path.dirname(os.path.dirname(cli_path)))

(o, e, ss) = run_cmd("tests.cli.main:app", "lilya --app tests.cli.main:app directives")
assert ss == 0

Expand Down
4 changes: 3 additions & 1 deletion tests/dependencies/test_simple_case_injected.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ async def async_client(app) -> AsyncGenerator:
async def test_injection(async_client):
response = await async_client.post("/", json={"name": "test", "content": "test"})
assert response.status_code == 201
assert response.json() == {"name": "test", "content": "test"}
jsonob = response.json()
jsonob.pop("id")
assert jsonob == {"name": "test", "content": "test"}
4 changes: 3 additions & 1 deletion tests/dependencies/test_simple_case_injected_no_construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ async def async_client(app) -> AsyncGenerator:
async def test_injection(async_client):
response = await async_client.post("/", json={"name": "test", "content": "test"})
assert response.status_code == 201
assert response.json() == {"name": "test", "content": "test"}
jsonob = response.json()
jsonob.pop("id")
assert jsonob == {"name": "test", "content": "test"}

0 comments on commit 6d32153

Please sign in to comment.