Skip to content

Commit

Permalink
@W-14603959 - Update backend dependencies (#2154)
Browse files Browse the repository at this point in the history
* @W-14603959 - Update backend deps and test failure fixes

* @W-14603959 - tsc indentation fixes

* @W-14603959 - moving django back to 4 LTS version and address reiew comments
  • Loading branch information
vsbharath authored Dec 15, 2023
1 parent 0027952 commit c12b902
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 243 deletions.
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

0 comments on commit c12b902

Please sign in to comment.