-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loosened import version-restriction to x.y instead of x.y.z.
- Loading branch information
Showing
4 changed files
with
91 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
Loosened the version-restrictions on PulpImport to only require X.Y matching. |
This file contains 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 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 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,28 @@ | ||
from unittest.mock import patch | ||
|
||
from django.test import TestCase | ||
from rest_framework.serializers import ValidationError | ||
|
||
from pulpcore.app.tasks.importer import _check_versions | ||
|
||
|
||
class TestObject: | ||
version = "1.2.3" # Every component is vers 1.2.3 | ||
|
||
|
||
class TestCheckVersions(TestCase): | ||
@patch("pulpcore.app.tasks.importer.get_distribution", return_value=TestObject()) | ||
def test_vers_check(self, mock_get_distribution): | ||
export_json = [{"component": "xyz", "version": "1.2.3"}] | ||
_check_versions(export_json) | ||
|
||
export_json = [{"component": "xy", "version": "1.2"}] | ||
_check_versions(export_json) | ||
|
||
export_json = [{"component": "x_noty_z", "version": "1.4.3"}] | ||
with self.assertRaises(ValidationError): | ||
_check_versions(export_json) | ||
|
||
export_json = [{"component": "notx_y_z", "version": "2.2.3"}] | ||
with self.assertRaises(ValidationError): | ||
_check_versions(export_json) |