Skip to content

Commit

Permalink
Rename CGW_FLUSH_TOKEN to CGW_AUTH_TOKEN (#1027)
Browse files Browse the repository at this point in the history
- Renames `CGW_FLUSH_TOKEN` to `CGW_AUTH_TOKEN` on several files.
  • Loading branch information
hectorgomezv committed Jan 17, 2024
1 parent 5c86839 commit e6f312a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ GUNICORN_WEB_RELOAD=false
# The Client Gateway URL. This is for triggering webhooks to invalidate its cache for example
#CGW_URL=http://127.0.0.1

# The Client Gateway /flush token.
#CGW_FLUSH_TOKEN=example-flush-token
# The Client Gateway /v1/hooks/events token.
#CGW_AUTH_TOKEN=example-auth-token

# The maximum number of retries to be done when connecting to the Safe Client Gateway
#CGW_SESSION_MAX_RETRIES=0
Expand Down
12 changes: 6 additions & 6 deletions src/chains/tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

class ChainNetworkHookTestCaseSetupCheck(TestCase):
@responses.activate
@override_settings(CGW_URL=None, CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL=None, CGW_AUTH_TOKEN="example-token")
def test_no_cgw_call_with_no_url(self) -> None:
ChainFactory.create()

assert len(responses.calls) == 0

@responses.activate
@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN=None)
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN=None)
def test_no_cgw_call_with_no_token(self) -> None:
ChainFactory.create()

assert len(responses.calls) == 0


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class ChainNetworkHookTestCase(TestCase):
@responses.activate
def test_on_chain_create(self) -> None:
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_on_chain_update(self) -> None:
)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class FeatureHookTestCase(TestCase):
@responses.activate
def test_on_feature_create_with_no_chain(self) -> None:
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_on_feature_update_with_multiple_chains(self) -> None:
)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class WalletHookTestCase(TestCase):
@responses.activate
def test_on_wallet_create_with_no_chain(self) -> None:
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_on_wallet_update_with_multiple_chains(self) -> None:
)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class GasPriceHookTestCase(TestCase):
def setUp(self) -> None:
self.chain = (
Expand Down
6 changes: 3 additions & 3 deletions src/clients/safe_client_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def setup_session() -> requests.Session:
def cgw_setup() -> tuple[str, str]:
if settings.CGW_URL is None:
raise ValueError("CGW_URL is not set. Skipping hook call")
if settings.CGW_FLUSH_TOKEN is None:
raise ValueError("CGW_FLUSH_TOKEN is not set. Skipping hook call")
return (settings.CGW_URL, settings.CGW_FLUSH_TOKEN)
if settings.CGW_AUTH_TOKEN is None:
raise ValueError("CGW_AUTH_TOKEN is not set. Skipping hook call")
return (settings.CGW_URL, settings.CGW_AUTH_TOKEN)


def hook_event(event: HookEvent) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
CORS_URLS_REGEX = r"^/api/.*$"

CGW_URL = os.environ.get("CGW_URL")
CGW_FLUSH_TOKEN = os.environ.get("CGW_FLUSH_TOKEN")
CGW_AUTH_TOKEN = os.environ.get("CGW_AUTH_TOKEN")
CGW_SESSION_MAX_RETRIES = int(os.environ.get("CGW_SESSION_MAX_RETRIES", "0"))
CGW_SESSION_TIMEOUT_SECONDS = int(os.environ.get("CGW_SESSION_TIMEOUT_SECONDS", "2"))

Expand Down
8 changes: 4 additions & 4 deletions src/safe_apps/tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Faker.seed(0)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class SafeAppHookTestCase(TestCase):
@responses.activate
def test_on_safe_app_create(self) -> None:
Expand Down Expand Up @@ -253,7 +253,7 @@ def test_on_safe_app_delete(self) -> None:
)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class ProviderHookTestCase(TestCase):
@responses.activate
def test_on_provider_create_with_no_safe_app(self) -> None:
Expand Down Expand Up @@ -334,7 +334,7 @@ def test_on_provider_delete_with_safe_app(self) -> None:
)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class TagHookTestCase(TestCase):
@responses.activate
def test_on_tag_create_with_no_safe_app(self) -> None:
Expand Down Expand Up @@ -446,7 +446,7 @@ def test_on_tag_update_with_multiple_safe_apps(self) -> None:
)


@override_settings(CGW_URL="http://127.0.0.1", CGW_FLUSH_TOKEN="example-token")
@override_settings(CGW_URL="http://127.0.0.1", CGW_AUTH_TOKEN="example-token")
class FeatureHookTestCase(TestCase):
@responses.activate
def test_on_feature_create_with_no_safe_app(self) -> None:
Expand Down

0 comments on commit e6f312a

Please sign in to comment.