Skip to content

Commit

Permalink
Fix leading space
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Jun 23, 2023
1 parent 663c23c commit bbe274e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/sign_workflow/signer_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def sign(self, artifact: str, basepath: Path, signature_type: str) -> None:
"-o",
signed_filename,
"-p",
"mac"
" -r",
"mac",
"-r",
str(self.overwrite)
]
self.git_repo.execute(" ".join(signing_cmd))
Expand Down
4 changes: 2 additions & 2 deletions src/sign_workflow/signer_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def sign(self, artifact: str, basepath: Path, signature_type: str) -> None:
"-o",
signed_filename,
"-p",
"windows"
" -r",
"windows",
"-r",
str(self.overwrite)
]
self.git_repo.execute(" ".join(signing_cmd))
Expand Down
16 changes: 10 additions & 6 deletions tests/tests_sign_workflow/test_signer_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@


class TestSignerMac(unittest.TestCase):

@patch("platform.system", return_value='Darwin')
@patch("sign_workflow.signer.GitRepository")
def test_accepted_file_types(self, git_repo: Mock) -> None:
def test_accepted_file_types(self, git_repo: Mock, platform_moc: Mock) -> None:
artifacts = [
"bad-xml.xml",
"the-dmg.dmg",
Expand All @@ -40,9 +40,10 @@ def test_accepted_file_types(self, git_repo: Mock) -> None:
self.assertEqual(signer.sign.call_args_list, expected)

@patch("sign_workflow.signer.GitRepository")
@patch("platform.system", return_value='Darwin')
@patch('os.rename')
@patch('os.mkdir')
def test_signer_sign(self, mock_os_mkdir: Mock, mock_os_rename: Mock, mock_repo: Mock) -> None:
def test_signer_sign(self, mock_os_mkdir: Mock, mock_os_rename: Mock, platform_moc: Mock, mock_repo: Mock) -> None:
signer = SignerMac(False)
signer.sign("the-pkg.pkg", Path("/path/"), "null")
command = "./opensearch-signer-client -i " + os.path.join(Path("/path/"),
Expand All @@ -51,8 +52,9 @@ def test_signer_sign(self, mock_os_mkdir: Mock, mock_os_rename: Mock, mock_repo:
mock_repo.assert_has_calls(
[call().execute(command)])

@patch("platform.system", return_value='Darwin')
@patch("sign_workflow.signer.GitRepository")
def test_sign_command_for_overwrite(self, mock_repo: Mock) -> None:
def test_sign_command_for_overwrite(self, mock_repo: Mock, platform_moc: Mock) -> None:
signer = SignerMac(True)
signer.sign("the-pkg.pkg", Path("/path/"), 'null')
command = "./opensearch-signer-client -i " + os.path.join(Path("/path/"),
Expand All @@ -61,14 +63,16 @@ def test_sign_command_for_overwrite(self, mock_repo: Mock) -> None:
mock_repo.assert_has_calls(
[call().execute(command)])

@patch("platform.system", return_value='Darwin')
@patch("sign_workflow.signer.GitRepository")
def test_signer_verify(self, mock_repo: Mock) -> None:
def test_signer_verify(self, mock_repo: Mock, platform_moc: Mock) -> None:
signer = SignerMac(True)
signer.verify("/path/the-pkg.pkg")
mock_repo.assert_has_calls([call().execute('pkgutil --check-signature /path/the-pkg.pkg')])

@patch("platform.system", return_value='Linux')
def test_signer_invalid_os(self, mock_system: Mock) -> None:
@patch("sign_workflow.signer.GitRepository")
def test_signer_invalid_os(self, mock_repo: Mock, platform_moc: Mock) -> None:
with self.assertRaises(OSError) as ctx:
signer = SignerMac(True)
signer.verify("/path/the-pkg.pkg")
Expand Down

0 comments on commit bbe274e

Please sign in to comment.