From 6ba22ab71e1f94c1445ac0c7d45bfdfcf474a3d2 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Mon, 15 Mar 2021 20:41:37 +0530 Subject: [PATCH 1/3] Correct API docs path and fix pytest invocation The earlier location http://127.0.0.1:8000/api/docs was a 404. As the urls.py suggests, the README now reflects http://127.0.0.1:8000/api/schema/swagger-ui/ After the first install, activating the venv is done prior to installing pytest, thus the system default pytest is being called. It is either required to reactive venv or run pytest via python -m. Signed-off-by: Hritik Vijay --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index d9d01bc22..682960e36 100644 --- a/README.rst +++ b/README.rst @@ -206,7 +206,7 @@ Run Tests Use these commands to run code style checks and the test suite:: black -l 100 --check . - DJANGO_DEV=1 pytest + DJANGO_DEV=1 python -m pytest Data import @@ -245,7 +245,7 @@ Start the webserver:: For full documentation about API endpoints use this URL:: - http://127.0.0.1:8000/api/docs + http://127.0.0.1:8000/api/schema/swagger-ui/ From 2dadee6f1d2560946f2a189fbe5af565fdd804a5 Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Wed, 17 Mar 2021 23:08:10 +0530 Subject: [PATCH 2/3] Use venv pytest in CI Here is the entire conversation: https://github.com/nexB/vulnerablecode/pull/379 Signed-off-by: Hritik Vijay --- .github/workflows/main.yml | 4 ++-- .travis.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61de40e28..01418af19 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,11 +38,11 @@ jobs: pip install -r requirements.txt - name: Run tests - run: pytest + run: python -m pytest env: # The hostname, username used to communicate with the PostgreSQL service container POSTGRES_HOST: localhost VC_DB_USER: postgres POSTGRES_PORT: 5432 DJANGO_DEV: 1 - GH_TOKEN: 1 \ No newline at end of file + GH_TOKEN: 1 diff --git a/.travis.yml b/.travis.yml index 41fcc48ae..e0f5a631a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_script: script: - ./manage.py collectstatic - - pytest + - python -m pytest notifications: email: false @@ -27,4 +27,4 @@ notifications: - https://webhooks.gitter.im/e/b119fa557626081e1f36 on_success: change # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always \ No newline at end of file + on_start: never # options: [always|never|change] default: always From 0ee064e5a52850482cbbdb0cf8ebba25f7821f8c Mon Sep 17 00:00:00 2001 From: Hritik Vijay Date: Wed, 17 Mar 2021 23:38:08 +0530 Subject: [PATCH 3/3] Point docs to http://127.0.0.1:8000/api/docs As mentioned in the previous version of README.rst, the docs should be at /api/docs. Signed-off-by: Hritik Vijay --- README.rst | 2 +- vulnerablecode/urls.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 682960e36..d328634c9 100644 --- a/README.rst +++ b/README.rst @@ -245,7 +245,7 @@ Start the webserver:: For full documentation about API endpoints use this URL:: - http://127.0.0.1:8000/api/schema/swagger-ui/ + http://127.0.0.1:8000/api/docs diff --git a/vulnerablecode/urls.py b/vulnerablecode/urls.py index 464a05254..ad8f2ce23 100644 --- a/vulnerablecode/urls.py +++ b/vulnerablecode/urls.py @@ -88,7 +88,7 @@ def __init__(self, *args, **kwargs): urlpatterns = [ path("admin/", admin.site.urls), path("api/schema/", SpectacularAPIView.as_view(), name="schema"), - path("api/schema/swagger-ui/", SpectacularSwaggerView.as_view(), name="swagger-ui"), + path("api/docs", SpectacularSwaggerView.as_view(), name="swagger-ui"), path("packages/search", PackageSearchView.as_view(), name="package_search"), path("packages/", PackageUpdate.as_view(), name="package_view"), path("vulnerabilities/", VulnerabilityDetails.as_view(), name="vulnerability_view"),