Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kalsky committed Oct 3, 2024
1 parent e9af961 commit 89c7b44
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions tests/test_utilities/test_versions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
import unittest
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, patch, Mock

from shellfoundry.utilities import is_index_version_greater_than_current

Expand All @@ -19,9 +19,12 @@ def test_current_version_greater_than_index(self):
get_response.content = return_json

# Act
with patch('shellfoundry.utilities.get_installed_version', return_value='1.0.0'), \
patch('shellfoundry.utilities.requests.get', return_value=get_response):
is_greater_version, is_major_release = is_index_version_greater_than_current()
with patch(
"shellfoundry.utilities.get_installed_version", return_value="1.0.0"
), patch("shellfoundry.utilities.requests.get", return_value=get_response):
is_greater_version, is_major_release = (
is_index_version_greater_than_current()
)

# Assert
self.assertFalse(is_greater_version)
Expand All @@ -38,9 +41,12 @@ def test_current_version_lower_than_index_by_a_patch(self):
get_response.content = return_json

# Act
with patch('shellfoundry.utilities.get_installed_version', return_value='0.2.7'), \
patch('shellfoundry.utilities.requests.get', return_value=get_response):
is_greater_version, is_major_release = is_index_version_greater_than_current()
with patch(
"shellfoundry.utilities.get_installed_version", return_value="0.2.7"
), patch("shellfoundry.utilities.requests.get", return_value=get_response):
is_greater_version, is_major_release = (
is_index_version_greater_than_current()
)

# Assert
self.assertTrue(is_greater_version)
Expand All @@ -57,9 +63,12 @@ def test_current_version_lower_than_index_by_a_major(self):
get_response.content = return_json

# Act
with patch('shellfoundry.utilities.get_installed_version', return_value='0.2.7'), \
patch('shellfoundry.utilities.requests.get', return_value=get_response):
is_greater_version, is_major_release = is_index_version_greater_than_current()
with patch(
"shellfoundry.utilities.get_installed_version", return_value="0.2.7"
), patch("shellfoundry.utilities.requests.get", return_value=get_response):
is_greater_version, is_major_release = (
is_index_version_greater_than_current()
)

# Assert
self.assertTrue(is_greater_version)
Expand All @@ -76,9 +85,12 @@ def test_current_version_is_equal_to_index_version(self):
get_response.content = return_json

# Act
with patch('shellfoundry.utilities.get_installed_version', return_value='0.2.7'), \
patch('shellfoundry.utilities.requests.get', return_value=get_response):
is_greater_version, is_major_release = is_index_version_greater_than_current()
with patch(
"shellfoundry.utilities.get_installed_version", return_value="0.2.7"
), patch("shellfoundry.utilities.requests.get", return_value=get_response):
is_greater_version, is_major_release = (
is_index_version_greater_than_current()
)

# Assert
self.assertFalse(is_greater_version)
Expand Down

0 comments on commit 89c7b44

Please sign in to comment.