-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APPAI-1776] Fixed sentry error due to invalid version (#737)
* [APPAI-1776] Fixed sentry error due to invalid version * Used version comparator utility instead of custom code * Moved version comparator to latest code * Revert "Moved version comparator to latest code" This reverts commit 7fb71d1. * Removed latest non-cve version loop * Reduced security issues and resolve 1 exploits, add required deps * Added more test cases to improve codecov * Moved conditions outside exception as per review comments * Moved comparison to else block as per review comments * Removed test case as per comments
- Loading branch information
1 parent
f4edec1
commit c07d525
Showing
6 changed files
with
24 additions
and
116 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
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
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 |
---|---|---|
|
@@ -2,11 +2,8 @@ | |
|
||
import datetime | ||
import pytest | ||
import semantic_version as sv | ||
from bayesian.utils import ( | ||
is_valid, get_user_email, | ||
convert_version_to_proper_semantic as cvs, | ||
version_info_tuple as vt, | ||
resolved_files_exist, | ||
get_ecosystem_from_manifest, | ||
check_for_accepted_ecosystem | ||
|
@@ -212,51 +209,6 @@ def test_github_url_exist_or_not(self): | |
self.__url).code == 200, "Not able to access the url {}".format(self.__url) | ||
|
||
|
||
def test_semantic_versioning(): | ||
"""Check the function cvs().""" | ||
package_name = "test_package" | ||
version = "-1" | ||
assert cvs(version, package_name) == sv.Version("0.0.0") | ||
version = "" | ||
assert cvs(version, package_name) == sv.Version("0.0.0") | ||
version = None | ||
assert cvs(version, package_name) == sv.Version("0.0.0") | ||
version = "1.5.2.RELEASE" | ||
assert cvs(version, package_name) == sv.Version("1.5.2+RELEASE") | ||
version = "1.5-2.RELEASE" | ||
assert cvs(version, package_name) == sv.Version("1.5.2+RELEASE") | ||
version = "2" | ||
assert cvs(version, package_name) == sv.Version("2.0.0") | ||
version = "2.3" | ||
assert cvs(version, package_name) == sv.Version("2.3.0") | ||
version = "2.0.rc1" | ||
assert cvs(version, package_name) == sv.Version("2.0.0+rc1") | ||
|
||
|
||
def test_version_info_tuple(): | ||
"""Check the function vt().""" | ||
version_str = "2.0.rc1" | ||
package_name = "test_package" | ||
version_obj = cvs(version_str, package_name) | ||
version_info = vt(version_obj) | ||
assert len(version_info) == 4 | ||
assert version_info[0] == version_obj.major | ||
assert version_info[1] == version_obj.minor | ||
assert version_info[2] == version_obj.patch | ||
assert version_info[3] == version_obj.build | ||
|
||
|
||
def test_version_info_tuple_empty_version_obj(): | ||
"""Check the function vt() for empty version object.""" | ||
version_obj = "" | ||
version_info = vt(version_obj) | ||
assert len(version_info) == 4 | ||
assert version_info[0] == 0 | ||
assert version_info[1] == 0 | ||
assert version_info[2] == 0 | ||
assert version_info[3] == tuple() | ||
|
||
|
||
def test_get_user_email(): | ||
"""Check the function get_user_email().""" | ||
assert get_user_email(None) == '[email protected]' | ||
|
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