Skip to content

Commit

Permalink
test changes
Browse files Browse the repository at this point in the history
Signed-off-by: Pratiksha Sankhe <[email protected]>
  • Loading branch information
psankhe28 committed Aug 17, 2024
1 parent 920cdd3 commit 069a6b5
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author_email": "[email protected]",
"development_status": "1 - Planning",
"short_description": "File handler utilizing TUS and MinIO with DRS-Filer integration.",
"project_name": "Tus-Storage-Handler",
"project_name": "tus_storagehandler",
"project_slug": "tus_storagehandler",
"github_username": "elixir-cloud-aai",
"python_version": "3.11",
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/run-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run Application

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies and run app
run: |
make v
source .venv/bin/activate
make i
tus_storagehandler
4 changes: 2 additions & 2 deletions deployment/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ security:

api:
specs:
- path: api/specs/specs.yaml
- path: tus_storagehandler/api/specs/specs.yaml
append: null
add_operation_fields:
x-openapi-router-controller: tus_storagehandler.api.elixircloud.csh.controllers
Expand All @@ -37,4 +37,4 @@ api:
exceptions:
required_members: [['message'], ['code']]
status_member: ['code']
exceptions: exceptions.exceptions
exceptions: tus_storagehandler.exceptions.exceptions
82 changes: 35 additions & 47 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ requires = ["poetry-core"]
warn_return_any = true
warn_unused_configs = true

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"connexion.*",
"foca",
]

[tool.poetry]
authors = ["ELIXIR Cloud AAI <[email protected]>"]
classifiers = [
Expand All @@ -17,14 +24,15 @@ classifiers = [
description = "File handler utilizing TUS and MinIO with DRS-Filer integration."
license = "Apache-2.0"
maintainers = ["ELIXIR Cloud AAI <[email protected]>"]
name = "Tus-Storage-Handler"
name = "tus_storagehandler"
readme = "README.md"
repository = "https://github.com/elixir-cloud-aai/tus_storagehandler"
version = "0.1.0"

[tool.poetry.dependencies]
python = ">=3.11,<4.0"
flask = "2.2.3"
foca = "^0.13.0"
python = ">=3.11,<4.0"
sphinx = "^8.0.2"

[tool.poetry.group.code_quality]
Expand Down Expand Up @@ -100,10 +108,3 @@ select = [

[tool.ruff.lint.pydocstyle]
convention = "google"

[[tool.mypy.overrides]]
module = [
"connexion.*",
"foca"
]
ignore_missing_imports = true
15 changes: 13 additions & 2 deletions tests/test_integration/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,26 @@

def test_get_root():
"""Test the root endpoint of the service with a mocked response."""
print("Starting test_get_root...")

server_url = "http://localhost:8080/elixircoud/csh/v1"

with mock.patch("requests.get") as mock_get:
mock_response = mock.Mock()
mock_response.status_code = HTTPStatus.OK
mock_get.return_value = mock_response

response = requests.get("http://localhost:8080/elixircoud/csh/v1")
response = requests.get(server_url)
print(f"Response status code: {response.status_code}")

assert (
response.status_code == HTTPStatus.OK
), f"Expected status code 200, got {response.status_code}"

mock_get.assert_called_once_with("http://localhost:8080/elixircoud/csh/v1")
mock_get.assert_called_once_with(server_url)

print("Finished test_get_root")


if __name__ == "__main__":
test_get_root()
2 changes: 1 addition & 1 deletion tus_storagehandler/api/specs/specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ paths:
'400':
description: The request is malformed.
'500':
description: An unexpected error occurred.
description: An unexpected error occurred.

0 comments on commit 069a6b5

Please sign in to comment.