Skip to content

Commit c004f6b

Browse files
fix: pylint errors
1 parent 5df4292 commit c004f6b

File tree

5 files changed

+29
-45
lines changed

5 files changed

+29
-45
lines changed

tests/test_api.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
"""Unit tests for Bitbucket API logic in manage_bitbucket_env.py."""
2+
from manage_bitbucket_env import get_environment_uuid, get_variables
23
import unittest
34
from unittest.mock import patch, Mock
45
import sys
56
import os
67
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
7-
from manage_bitbucket_env import get_environment_uuid, get_variables
88

99
class TestAPI(unittest.TestCase):
1010
"""Test API-related functions."""
11-
logger = None
12-
auth = None
13-
workspace = None
14-
repo_slug = None
15-
deployment_name = None
16-
env_uuid = None
1711

1812
def setUp(self):
1913
"""Set up test fixtures."""
20-
self.logger = Mock()
21-
self.auth = Mock()
22-
self.workspace = 'ws'
23-
self.repo_slug = 'repo'
24-
self.deployment_name = 'env'
25-
self.env_uuid = 'uuid-123'
14+
self.logger: Mock = Mock()
15+
self.auth: Mock = Mock()
16+
self.workspace: str = 'ws'
17+
self.repo_slug: str = 'repo'
18+
self.deployment_name: str = 'env'
19+
self.env_uuid: str = 'uuid-123'
2620

2721
@patch('manage_bitbucket_env.requests.get')
2822
def test_get_environment_uuid_found(self, mock_get):

tests/test_arg_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Unit tests for argument parsing in manage_bitbucket_env.py."""
2+
from manage_bitbucket_env import arg_parser
23
import unittest
34
from unittest.mock import patch
45
import sys
56
import os
67
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
7-
from manage_bitbucket_env import arg_parser
88

99
class TestArgParser(unittest.TestCase):
1010
"""Test argument parsing functionality."""

tests/test_export_import.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
"""Unit tests for export/import logic in manage_bitbucket_env.py."""
22
# pylint: disable=duplicate-code
3+
from manage_bitbucket_env import (
4+
export_variables, export_all_variables, export_secure_keys, import_variables
5+
)
36
import unittest
47
from unittest.mock import patch, Mock
58
import sys
69
import os
710
import tempfile
811
import json
912
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
10-
from manage_bitbucket_env import (
11-
export_variables, export_all_variables, export_secure_keys, import_variables
12-
)
1313

1414
class TestExportImport(unittest.TestCase):
1515
"""Test export and import functionality."""
16-
logger = None
17-
auth = None
18-
workspace = None
19-
repo_slug = None
20-
deployment_name = None
21-
env_uuid = None
2216

2317
def setUp(self):
2418
"""Set up test fixtures."""
25-
self.logger = Mock()
26-
self.auth = Mock()
27-
self.workspace = 'ws'
28-
self.repo_slug = 'repo'
29-
self.deployment_name = 'env'
30-
self.env_uuid = 'uuid-123'
19+
self.logger: Mock = Mock()
20+
self.auth: Mock = Mock()
21+
self.workspace: str = 'ws'
22+
self.repo_slug: str = 'repo'
23+
self.deployment_name: str = 'env'
24+
self.env_uuid: str = 'uuid-123'
3125

3226
@patch('manage_bitbucket_env.get_environment_uuid')
3327
@patch('manage_bitbucket_env.get_variables')

tests/test_main.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""Unit tests for main function integration in manage_bitbucket_env.py."""
2+
# pylint: disable=unused-argument
3+
from manage_bitbucket_env import main
24
import unittest
35
from unittest.mock import patch, Mock
46
import sys
57
import os
68
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
7-
from manage_bitbucket_env import main
89

910
class TestMainFunction(unittest.TestCase):
1011
"""Test main function integration."""
11-
mock_logger = None
1212

1313
def setUp(self):
1414
"""Set up test fixtures."""
15-
self.mock_logger = Mock()
15+
self.mock_logger: Mock = Mock()
1616

1717
@patch('manage_bitbucket_env.arg_parser')
1818
@patch('manage_bitbucket_env.load_dotenv')
@@ -29,10 +29,11 @@ def test_main_export_variables(self, mock_export, mock_auth, mock_env_get,
2929
mock_args.repo_slug = 'test-repo'
3030
mock_args.deployment_name = 'test-deployment'
3131
mock_arg_parser.return_value = mock_args
32-
mock_env_get.side_effect = lambda x: {
32+
env_dict = {
3333
'BITBUCKET_USERNAME': 'test_user',
3434
'BITBUCKET_APP_PASSWORD': 'test_password'
35-
}.get(x)
35+
}
36+
mock_env_get.side_effect = env_dict.get
3637
mock_auth_instance = Mock()
3738
mock_auth.return_value = mock_auth_instance
3839
main(self.mock_logger)

tests/test_update_vars.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
"""Unit tests for update_vars logic in manage_bitbucket_env.py."""
22
# pylint: disable=duplicate-code
3+
from manage_bitbucket_env import update_vars
34
import unittest
45
from unittest.mock import patch, Mock
56
import sys
67
import os
78
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
8-
from manage_bitbucket_env import update_vars
99

1010
class TestUpdateVars(unittest.TestCase):
1111
"""Test variable update functionality."""
12-
logger = None
13-
auth = None
14-
workspace = None
15-
repo_slug = None
16-
env_uuid = None
1712

1813
def setUp(self):
1914
"""Set up test fixtures."""
20-
self.logger = Mock()
21-
self.auth = Mock()
22-
self.workspace = 'ws'
23-
self.repo_slug = 'repo'
24-
self.env_uuid = 'uuid-123'
15+
self.logger: Mock = Mock()
16+
self.auth: Mock = Mock()
17+
self.workspace: str = 'ws'
18+
self.repo_slug: str = 'repo'
19+
self.env_uuid: str = 'uuid-123'
2520

2621
@patch('manage_bitbucket_env.requests.put')
2722
def test_update_existing(self, mock_put):

0 commit comments

Comments
 (0)