forked from getsentry/sentry-auth-google
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: adapt dependency management for v24
- Loading branch information
Showing
11 changed files
with
100 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ venv | |
.venv | ||
.coverage | ||
.vscode/ | ||
# Fetched from upstream | ||
requirements-sentry.txt | ||
tests/conftest.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.10.13 | ||
3.11.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
services: | ||
postgres: | ||
image: postgres:14.11 | ||
environment: | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
# Set health checks to wait until postgres has started | ||
healthcheck: | ||
test: ["CMD-SHELL", “pg_isready”] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
ports: | ||
- 5432:5432 | ||
memcached: | ||
image: memcached:1.6.23-alpine | ||
ports: | ||
- 11211:11211 | ||
redis: | ||
image: redis:6.2.14-alpine | ||
ports: | ||
- 6379:6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,11 @@ | |
name = "sentry-auth-oidc" | ||
version = "8.0.0" | ||
description = "OpenID Connect authentication provider for Sentry" | ||
authors = ["Max Wittig <[email protected]>, Diego Louzán <[email protected]>"] | ||
authors = [ | ||
"Max Wittig <[email protected]>", | ||
"Diego Louzán <[email protected]>", | ||
"Nejc Habjan <[email protected]>", | ||
] | ||
license = "Apache 2.0" | ||
readme = "README.rst" | ||
classifiers = [ | ||
|
@@ -16,14 +20,18 @@ packages = [ | |
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
python = "^3.11" | ||
|
||
[tool.poetry.dev-dependencies] | ||
black = "^22.8.0" | ||
isort = "^5.7.0" | ||
flake8 = "^3.8.4" | ||
|
||
[tool.poetry.group.test.dependencies] | ||
codecov = "^2.1.12" | ||
pytest = "^7.1.3" | ||
sentry = {git = "https://github.com/getsentry/sentry.git", rev = "24.2.0"} | ||
fixtures = "^4.1.0" | ||
|
||
[tool.isort] | ||
profile = "black" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,55 +2,48 @@ | |
from sentry import auth | ||
from sentry.auth.exceptions import IdentityNotValid | ||
from sentry.models import AuthIdentity, AuthProvider | ||
from sentry.testutils import TestCase | ||
from sentry.testutils.cases import TestCase | ||
from sentry.testutils.silo import control_silo_test | ||
|
||
from oidc.constants import DATA_VERSION | ||
from oidc.provider import OIDCProvider | ||
|
||
|
||
@control_silo_test | ||
class OIDCProviderTest(TestCase): | ||
def setUp(self): | ||
self.user = self.create_user("[email protected]") | ||
self.org = self.create_organization(owner=self.user) | ||
self.auth_provider = AuthProvider.objects.create( | ||
provider="oidc", | ||
organization=self.org, | ||
self.auth_provider_inst = AuthProvider.objects.create( | ||
provider="oidc", organization_id=self.organization.id | ||
) | ||
auth.register("oidc", OIDCProvider) | ||
super(OIDCProviderTest, self).setUp() | ||
super().setUp() | ||
|
||
def test_refresh_identity_without_refresh_token(self): | ||
auth_identity = AuthIdentity.objects.create( | ||
auth_provider=self.auth_provider, | ||
auth_provider=self.auth_provider_inst, | ||
user=self.user, | ||
data={ | ||
"access_token": "access_token", | ||
}, | ||
data={"access_token": "access_token"}, | ||
) | ||
|
||
provider = self.auth_provider.get_provider() | ||
provider = self.auth_provider_inst.get_provider() | ||
|
||
with pytest.raises(IdentityNotValid): | ||
provider.refresh_identity(auth_identity) | ||
|
||
def test_handles_multiple_domains(self): | ||
self.auth_provider.update( | ||
config={"domains": ["example.com"]}, | ||
) | ||
self.auth_provider_inst.update(config={"domains": ["example.com"]}) | ||
|
||
provider = self.auth_provider.get_provider() | ||
provider = self.auth_provider_inst.get_provider() | ||
assert provider.domains == ["example.com"] | ||
|
||
def test_handles_legacy_single_domain(self): | ||
self.auth_provider.update( | ||
config={"domain": "example.com"}, | ||
) | ||
self.auth_provider_inst.update(config={"domain": "example.com"}) | ||
|
||
provider = self.auth_provider.get_provider() | ||
provider = self.auth_provider_inst.get_provider() | ||
assert provider.domains == ["example.com"] | ||
|
||
def test_build_config(self): | ||
provider = self.auth_provider.get_provider() | ||
provider = self.auth_provider_inst.get_provider() | ||
state = { | ||
"domain": "example.com", | ||
"user": { | ||
|
@@ -67,7 +60,4 @@ def test_build_config(self): | |
}, | ||
} | ||
result = provider.build_config(state) | ||
assert result == { | ||
"domains": ["example.com"], | ||
"version": DATA_VERSION, | ||
} | ||
assert result == {"domains": ["example.com"], "version": DATA_VERSION} |