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

@W-14603959 - Update backend deps and test failure fixes #2154

Merged
merged 3 commits into from
Dec 15, 2023
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
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def safe_key() -> str:
MIDDLEWARE = [
"metecho.logging_middleware.LoggingMiddleware",
"sfdo_template_helpers.admin.middleware.AdminRestrictMiddleware",
"allauth.account.middleware.AccountMiddleware",
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down
20 changes: 20 additions & 0 deletions docs/api/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,11 @@ components:
- Review
- Merged
type: string
description: |-
* `Planned` - Planned
* `In progress` - In Progress
* `Review` - Review
* `Merged` - Merged
FullUser:
type: object
properties:
Expand Down Expand Up @@ -2118,6 +2123,10 @@ components:
- QA
- Playground
type: string
description: |-
* `Dev` - Dev
* `QA` - QA
* `Playground` - Playground
PaginatedEpicList:
type: object
properties:
Expand Down Expand Up @@ -2481,11 +2490,17 @@ components:
- Approved
- Changes requested
type: string
description: |-
* `Approved` - Approved
* `Changes requested` - Changes Requested
RoleEnum:
enum:
- assigned_qa
- assigned_dev
type: string
description: |-
* `assigned_qa` - assigned_qa
* `assigned_dev` - assigned_dev
ScratchOrg:
type: object
properties:
Expand Down Expand Up @@ -2909,6 +2924,11 @@ components:
- Completed
- Canceled
type: string
description: |-
* `Planned` - Planned
* `In progress` - In Progress
* `Completed` - Completed
* `Canceled` - Canceled
securitySchemes:
cookieAuth:
type: apiKey
Expand Down
4 changes: 3 additions & 1 deletion metecho/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,10 @@ def __str__(self):
return self.name

def save(self, *args, **kwargs):
if not self.id:
super().save(*args, **kwargs)
self.update_status()
return super().save(*args, **kwargs)
return super().save()

def subscribable_by(self, user): # pragma: nocover
return True
Expand Down
19 changes: 15 additions & 4 deletions metecho/oauth2/salesforce/tests/provider.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
from ..provider import CustomSalesforceProvider
import pytest


def test_get_auth_params(rf):
@pytest.mark.django_db
def test_get_auth_params(rf, social_app_factory):
request = rf.get("/")
result = CustomSalesforceProvider(request).get_auth_params(request, None)
app = social_app_factory(
name=CustomSalesforceProvider.id,
provider=CustomSalesforceProvider.id,
)
result = CustomSalesforceProvider(request, app).get_auth_params(request, None)
assert "prompt" in result and result["prompt"] == "login"


def test_extract_uid(rf):
@pytest.mark.django_db
def test_extract_uid(rf, social_app_factory):
request = rf.get("/")
provider = CustomSalesforceProvider(request)
app = social_app_factory(
name=CustomSalesforceProvider.id,
provider=CustomSalesforceProvider.id,
)
provider = CustomSalesforceProvider(request, app)
result = provider.extract_uid({"organization_id": "ORG", "user_id": "USER"})
assert result == "ORG/USER"
2 changes: 1 addition & 1 deletion metecho/oauth2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def ensure_socialapp_in_db(token):
unless we create them here.
"""
if token.app.pk is None:
provider = providers.registry.by_id(token.app.provider)
provider = providers.registry.get_class(token.app.provider)
app, created = SocialApp.objects.get_or_create(
provider=provider.id,
name=provider.name,
Expand Down
Loading
Loading