Skip to content

feat: Add PUT endpoint for versions and related tests#16

Merged
mtruj013 merged 4 commits into
mainfrom
put-version-endpoint
Apr 21, 2026
Merged

feat: Add PUT endpoint for versions and related tests#16
mtruj013 merged 4 commits into
mainfrom
put-version-endpoint

Conversation

@mtruj013
Copy link
Copy Markdown
Collaborator

@mtruj013 mtruj013 commented Apr 13, 2026

Done

  • Added PUT endpoint for versions and related tests

QA

  • See that tests pass
  • For a more thorough QA:
    • Run the site using the command dotrun
    • Updated a couple versions and see that everything passes as intended, sample curls

Issue / Card

https://warthogs.atlassian.net/browse/WD-33173

@mtruj013 mtruj013 changed the title Add PUT endpoint for versions and related tests feat: Add PUT endpoint for versions and related tests Apr 13, 2026
Copy link
Copy Markdown
Member

@immortalcodes immortalcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment.
LGTM!

Comment thread webapp/schemas.py
@mtruj013 mtruj013 force-pushed the put-version-endpoint branch from d502026 to 5335864 Compare April 20, 2026 12:41
@mtruj013 mtruj013 changed the base branch from post-version-endpoint to main April 20, 2026 14:11
@mtruj013 mtruj013 force-pushed the put-version-endpoint branch from d35998b to 121d946 Compare April 21, 2026 11:34
@mtruj013
Copy link
Copy Markdown
Collaborator Author

Thanks @immortalcodes , addressed your comment and added the following since you last looked:

  • validation for release_date being in the past in relation to support dates
  • related tests for the above

I'll flag the new bits in the changed files so that it's easier as well

{"product_slug": "does-not-exist"},
)

def test_update_version_lifecycle_date_before_release_date_returns_400(self):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the following tests are new

Comment thread webapp/helpers.py
)


def validate_dates_after_release(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New

Comment thread webapp/views.py
Comment on lines +441 to +478
effective_release_date_str = (data.get("release_date", {}) or {}).get(
"date"
) or (version.release_date or {}).get("date")

if effective_release_date_str:
try:
effective_release_date = date.fromisoformat(
effective_release_date_str
)
except (TypeError, ValueError):
effective_release_date = None

if effective_release_date:
lifecycle_fields = {
"supported": data.get("supported", version.supported or {}),
"esm_pro_supported": data.get(
"esm_pro_supported",
version.esm_pro_supported or {},
),
"break_bug_pro_supported": data.get(
"break_bug_pro_supported",
version.break_bug_pro_supported or {},
),
"legacy_supported": data.get(
"legacy_supported",
version.legacy_supported or {},
),
}
errors = validate_dates_after_release(
effective_release_date, lifecycle_fields
)
if errors:
return {
"error": {
"message": "Invalid request.",
"details": errors,
}
}, 400
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New

Copy link
Copy Markdown
Member

@immortalcodes immortalcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread webapp/helpers.py Outdated
@mtruj013 mtruj013 merged commit 72daf2a into main Apr 21, 2026
4 checks passed
@mtruj013 mtruj013 deleted the put-version-endpoint branch April 21, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants