Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate API_PREFIX #922

Merged
merged 2 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ The types of changes are:
* Update `fideslang` to `1.1.0`, simplifying the default taxonomy and adding `tags` for resources [#865](https://github.com/ethyca/fides/pull/865)
* Remove the `obscure` requirement from the `generate` endpoint [#819](https://github.com/ethyca/fides/pull/819)

### Developer Experience

* Remove `API_PREFIX` from fidesctl/core/utils.py and change references to `API_PREFIX` in fidesctl/api/reoutes/util.py [922](https://github.com/ethyca/fides/pull/922)

### Docs

* recommend/replace pip installs with pipx [#874](https://github.com/ethyca/fides/pull/874)
Expand Down
3 changes: 1 addition & 2 deletions src/fidesctl/api/routes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from fastapi import HTTPException, status

from fidesctl.api.utils.api_router import APIRouter
from fidesctl.core.utils import API_PREFIX as _API_PREFIX

API_PREFIX = _API_PREFIX
API_PREFIX = "/api/v1"
WEBAPP_DIRECTORY = Path("src/fidesctl/api/build/static")
WEBAPP_INDEX = WEBAPP_DIRECTORY / "index.html"

Expand Down
3 changes: 2 additions & 1 deletion src/fidesctl/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)

import fidesctl
from fidesctl.api.routes.util import API_PREFIX
from fidesctl.connectors.models import AWSConfig, BigQueryConfig, OktaConfig
from fidesctl.core import api as _api
from fidesctl.core.config import FidesctlConfig
Expand All @@ -32,7 +33,7 @@
get_config_okta_credentials,
)
from fidesctl.core.config.utils import get_config_from_file, update_config_file
from fidesctl.core.utils import API_PREFIX, check_response, echo_green, echo_red
from fidesctl.core.utils import check_response, echo_green, echo_red


def check_server(cli_version: str, server_url: str, quiet: bool = False) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/fidesctl/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import requests

from fidesctl.core.utils import API_PREFIX
from fidesctl.api.routes.util import API_PREFIX


def generate_resource_url(
Expand Down
4 changes: 0 additions & 4 deletions src/fidesctl/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
echo_red = partial(click.secho, fg="red", bold=True)
echo_green = partial(click.secho, fg="green", bold=True)

# This duplicates a constant in `fidesctl/api/routes/utils.py`
# To avoid import errors
API_PREFIX = "/api/v1"


def check_response(response: requests.Response) -> requests.Response:
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from requests_mock import Mocker

import fidesctl.cli.utils as utils
from fidesctl.api.routes.util import API_PREFIX
from fidesctl.core.config import FidesctlConfig
from fidesctl.core.utils import API_PREFIX


@pytest.mark.unit
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from starlette.testclient import TestClient

from fidesctl.api.routes import health
from fidesctl.api.routes.util import API_PREFIX
from fidesctl.core import api as _api
from fidesctl.core.config import FidesctlConfig
from fidesctl.core.utils import API_PREFIX


# Helper Functions
Expand Down