-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix desktop appcast endpoint to support 2-component version tags #5286
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
Open
atlas-agent-omi
wants to merge
1
commit into
main
Choose a base branch
from
atlas/fix-desktop-release-tag-pattern
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+126
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| """Tests for desktop version tag parsing.""" | ||
| import pytest | ||
| import sys | ||
| import os | ||
|
|
||
| # Add backend to path | ||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) | ||
|
|
||
| from routers.updates import _parse_desktop_version | ||
|
|
||
|
|
||
| class TestDesktopVersionParser: | ||
| """Test _parse_desktop_version function.""" | ||
|
|
||
| def test_old_3_component_format_with_cm_suffix(self): | ||
| """Test old 3-component format: v1.0.77+464-desktop-cm""" | ||
| result = _parse_desktop_version("v1.0.77+464-desktop-cm") | ||
| assert result is not None | ||
| assert result['major'] == '1' | ||
| assert result['minor'] == '0' | ||
| assert result['patch'] == '77' | ||
| assert result['build'] == '464' | ||
| assert result['version'] == '1.0.77+464' | ||
| assert result['tag_name'] == 'v1.0.77+464-desktop-cm' | ||
|
|
||
| def test_old_3_component_format_with_auto_suffix(self): | ||
| """Test old 3-component format: v1.0.524+614-desktop-auto""" | ||
| result = _parse_desktop_version("v1.0.524+614-desktop-auto") | ||
| assert result is not None | ||
| assert result['major'] == '1' | ||
| assert result['minor'] == '0' | ||
| assert result['patch'] == '524' | ||
| assert result['build'] == '614' | ||
| assert result['version'] == '1.0.524+614' | ||
|
|
||
| def test_old_3_component_macos_format(self): | ||
| """Test old 3-component format: v0.6.4+6004-macos""" | ||
| result = _parse_desktop_version("v0.6.4+6004-macos") | ||
| assert result is not None | ||
| assert result['major'] == '0' | ||
| assert result['minor'] == '6' | ||
| assert result['patch'] == '4' | ||
| assert result['build'] == '6004' | ||
| assert result['version'] == '0.6.4+6004' | ||
|
|
||
| def test_new_2_component_v11_format(self): | ||
| """Test new 2-component format: v11.0+11000-macos""" | ||
| result = _parse_desktop_version("v11.0+11000-macos") | ||
| assert result is not None | ||
| assert result['major'] == '11' | ||
| assert result['minor'] == '0' | ||
| assert result['patch'] == '0' # defaults to 0 | ||
| assert result['build'] == '11000' | ||
| assert result['version'] == '11.0.0+11000' | ||
|
|
||
| def test_new_2_component_v11_3_format(self): | ||
| """Test new 2-component format: v11.3+11003-macos""" | ||
| result = _parse_desktop_version("v11.3+11003-macos") | ||
| assert result is not None | ||
| assert result['major'] == '11' | ||
| assert result['minor'] == '3' | ||
| assert result['patch'] == '0' # defaults to 0 | ||
| assert result['build'] == '11003' | ||
| assert result['version'] == '11.3.0+11003' | ||
|
|
||
| def test_3_component_v0_11_format(self): | ||
| """Test 3-component v0.11.x format: v0.11.38+11038-macos""" | ||
| result = _parse_desktop_version("v0.11.38+11038-macos") | ||
| assert result is not None | ||
| assert result['major'] == '0' | ||
| assert result['minor'] == '11' | ||
| assert result['patch'] == '38' | ||
| assert result['build'] == '11038' | ||
| assert result['version'] == '0.11.38+11038' | ||
|
|
||
| def test_without_v_prefix(self): | ||
| """Test without v prefix: 0.11.41+1100-macos""" | ||
| result = _parse_desktop_version("0.11.41+1100-macos") | ||
| assert result is not None | ||
| assert result['major'] == '0' | ||
| assert result['minor'] == '11' | ||
| assert result['patch'] == '41' | ||
| assert result['build'] == '1100' | ||
| assert result['version'] == '0.11.41+1100' | ||
|
|
||
| def test_windows_platform(self): | ||
| """Test Windows platform: v1.0.77+464-windows""" | ||
| result = _parse_desktop_version("v1.0.77+464-windows") | ||
| assert result is not None | ||
| assert result['version'] == '1.0.77+464' | ||
|
|
||
| def test_linux_platform(self): | ||
| """Test Linux platform: v1.0.77+464-linux""" | ||
| result = _parse_desktop_version("v1.0.77+464-linux") | ||
| assert result is not None | ||
| assert result['version'] == '1.0.77+464' | ||
|
|
||
| def test_firmware_tag_rejected(self): | ||
| """Test that firmware tags are rejected: Omi_CV1_v3.0.15""" | ||
| result = _parse_desktop_version("Omi_CV1_v3.0.15") | ||
| assert result is None | ||
|
|
||
| def test_missing_build_number_rejected(self): | ||
| """Test that tags without build number are rejected: v1.0.77-macos""" | ||
| result = _parse_desktop_version("v1.0.77-macos") | ||
| assert result is None | ||
|
|
||
| def test_non_numeric_build_rejected(self): | ||
| """Test that tags with non-numeric build are rejected: v1.0.77+abc-macos""" | ||
| result = _parse_desktop_version("v1.0.77+abc-macos") | ||
| assert result is None | ||
|
|
||
| def test_case_insensitive_platform(self): | ||
| """Test case insensitive platform matching: v1.0.77+464-MACOS""" | ||
| result = _parse_desktop_version("v1.0.77+464-MACOS") | ||
| assert result is not None | ||
| assert result['version'] == '1.0.77+464' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
sys.path.insertis unnecessary. Other test files in the project (e.g.,test_firmware_pagination.py,test_geocoding_cache.py) import directly from modules without path manipulation, relying on pytest'spythonpath = ["."]configuration inpyproject.toml. Remove these lines and keep only the import statement.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!