Skip to content

Update default API version to v2, fix v1 tests - #450

Merged
jrhoads merged 2 commits into
devfrom
v2-as-default
Jul 28, 2025
Merged

Update default API version to v2, fix v1 tests#450
jrhoads merged 2 commits into
devfrom
v2-as-default

Conversation

@jrhoads

@jrhoads jrhoads commented Jul 25, 2025

Copy link
Copy Markdown
Member

Purpose

This PR updates the default API version to v2 and fixes tests for the generateaddress endpoint in v1.

Approach

The DEFAULT_VERSION in settings.py was changed from v1 to v2. Additionally, the GenerateAddressViewTestCase in tests_views_v1.py was modified to explicitly call the v1 endpoint by prefixing the URL with /v1/. A stray V1_VERSION constant was also added, although it's not directly used in the diff provided. Finally, the mock for new_geonames in tests_views_v2.py was updated to new_geonames_v2 to align with the v2 context.

Key Modifications

  • Changed DEFAULT_VERSION from v1 to v2 in rorapi/settings.py.
  • Updated GenerateAddressViewTestCase in rorapi/tests/tests_unit/tests_views_v1.py to use /v1/generateaddress/ for tests.
  • Modified the mock for the Geonames function in rorapi/tests/tests_unit/tests_views_v2.py from update_address.new_geonames to update_address.new_geonames_v2.

Important Technical Details

  • The switch of the default version means that clients not explicitly specifying a version will now hit the v2 API.
  • The generateaddress endpoint in v1 tests now correctly targets the v1 path, ensuring future-proof testing as the API evolves.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@jrhoads
jrhoads requested review from adambuttrick and kaysiz July 25, 2025 14:20
@jrhoads jrhoads changed the title refactor: Apply versioning to the /generateaddress endpoint tests Update default API version to v2, fix v1 tests Jul 28, 2025

@kaysiz kaysiz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@jrhoads
jrhoads merged commit 26f0d0d into dev Jul 28, 2025
jrhoads added a commit that referenced this pull request Jul 28, 2025
@jrhoads
jrhoads deleted the v2-as-default branch October 24, 2025 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants