ci: ensure same checks as locally are run

This commit is contained in:
Jens Langhammer 2020-09-26 19:08:37 +02:00
parent c1058c7438
commit f27b43507c
3 changed files with 14 additions and 13 deletions

View File

@ -8,13 +8,13 @@ coverage:
lint-fix: lint-fix:
isort -rc . isort -rc .
black . black passbook e2e lifecycle
lint: lint:
pyright pyright pyright e2e lifecycle
bandit -r . bandit -r passbook e2e lifecycle
pylint passbook e2e lifecycle pylint passbook e2e lifecycle
prospector prospector passbook e2e lifecycle
gen: coverage gen: coverage
./manage.py generate_swagger -o swagger.yaml -f yaml ./manage.py generate_swagger -o swagger.yaml -f yaml

View File

@ -30,7 +30,7 @@ stages:
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run pylint passbook script: pipenv run pylint passbook e2e lifecycle
- job: black - job: black
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
@ -45,7 +45,7 @@ stages:
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run black --check passbook script: pipenv run black --check passbook e2e lifecycle
- job: prospector - job: prospector
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
@ -61,7 +61,7 @@ stages:
pipenv install --dev prospector --skip-lock pipenv install --dev prospector --skip-lock
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run prospector passbook script: pipenv run prospector passbook e2e lifecycle
- job: bandit - job: bandit
pool: pool:
vmImage: 'ubuntu-latest' vmImage: 'ubuntu-latest'
@ -76,7 +76,7 @@ stages:
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run bandit -r passbook script: pipenv run bandit -r passbook e2e lifecycle
- job: pyright - job: pyright
pool: pool:
vmImage: ubuntu-latest vmImage: ubuntu-latest
@ -97,7 +97,7 @@ stages:
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run pyright script: pipenv run pyright e2e lifecycle
- stage: Test - stage: Test
jobs: jobs:
- job: migrations - job: migrations

View File

@ -22,7 +22,6 @@ from passbook.providers.oauth2.generators import (
) )
from passbook.sources.oauth.models import OAuthSource from passbook.sources.oauth.models import OAuthSource
TOKEN_URL = "http://127.0.0.1:5556/dex/token"
CONFIG_PATH = "/tmp/dex.yml" CONFIG_PATH = "/tmp/dex.yml"
LOGGER = get_logger() LOGGER = get_logger()
@ -94,14 +93,14 @@ class TestSourceOAuth2(SeleniumTestCase):
authentication_flow = Flow.objects.get(slug="default-source-authentication") authentication_flow = Flow.objects.get(slug="default-source-authentication")
enrollment_flow = Flow.objects.get(slug="default-source-enrollment") enrollment_flow = Flow.objects.get(slug="default-source-enrollment")
OAuthSource.objects.create( OAuthSource.objects.create( # nosec
name="dex", name="dex",
slug="dex", slug="dex",
authentication_flow=authentication_flow, authentication_flow=authentication_flow,
enrollment_flow=enrollment_flow, enrollment_flow=enrollment_flow,
provider_type="openid-connect", provider_type="openid-connect",
authorization_url="http://127.0.0.1:5556/dex/auth", authorization_url="http://127.0.0.1:5556/dex/auth",
access_token_url=TOKEN_URL, access_token_url="http://127.0.0.1:5556/dex/token",
profile_url="http://127.0.0.1:5556/dex/userinfo", profile_url="http://127.0.0.1:5556/dex/userinfo",
consumer_key="example-app", consumer_key="example-app",
consumer_secret=self.client_secret, consumer_secret=self.client_secret,
@ -247,6 +246,8 @@ class TestSourceOAuth2(SeleniumTestCase):
@skipUnless(platform.startswith("linux"), "requires local docker") @skipUnless(platform.startswith("linux"), "requires local docker")
class TestSourceOAuth1(SeleniumTestCase): class TestSourceOAuth1(SeleniumTestCase):
"""Test OAuth1 Source"""
def setUp(self) -> None: def setUp(self) -> None:
self.client_id = generate_client_id() self.client_id = generate_client_id()
self.client_secret = generate_client_secret() self.client_secret = generate_client_secret()
@ -277,7 +278,7 @@ class TestSourceOAuth1(SeleniumTestCase):
authentication_flow = Flow.objects.get(slug="default-source-authentication") authentication_flow = Flow.objects.get(slug="default-source-authentication")
enrollment_flow = Flow.objects.get(slug="default-source-enrollment") enrollment_flow = Flow.objects.get(slug="default-source-enrollment")
OAuthSource.objects.create( OAuthSource.objects.create( # nosec
name="oauth1", name="oauth1",
slug=self.source_slug, slug=self.source_slug,
authentication_flow=authentication_flow, authentication_flow=authentication_flow,