Skip to content

Commit

Permalink
Change path for windows tests
Browse files Browse the repository at this point in the history
Signed-off-by: Zelin Hao <[email protected]>
  • Loading branch information
zelinh committed Jun 28, 2022
1 parent 5129326 commit 1e1a56e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/sign_workflow/signer_pgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
from pathlib import Path

from git.git_repository import GitRepository
from sign_workflow.signer import Signer

"""
Expand All @@ -19,7 +18,6 @@


class SignerPGP(Signer):
git_repo: GitRepository

ACCEPTED_FILE_TYPES = [".zip", ".jar", ".war", ".pom", ".module", ".tar.gz", ".whl", ".crate", ".rpm"]

Expand Down
2 changes: 0 additions & 2 deletions src/sign_workflow/signer_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
from pathlib import Path

from git.git_repository import GitRepository
from sign_workflow.signer import Signer

"""
Expand All @@ -19,7 +18,6 @@


class SignerWindows(Signer):
git_repo: GitRepository

ACCEPTED_FILE_TYPES = [".msi", ".exe", ".dll", ".sys", ".ps1", ".psm1", ".psd1", ".cat", ".zip"]

Expand Down
7 changes: 5 additions & 2 deletions tests/tests_sign_workflow/test_signer_pgp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest
from pathlib import Path
from unittest.mock import MagicMock, Mock, call, patch
Expand Down Expand Up @@ -90,12 +91,14 @@ def test_signer_verify_sig(self, mock_repo: Mock) -> None:
def test_signer_sign_asc(self, mock_repo: Mock) -> None:
signer = SignerPGP()
signer.sign("the-jar.jar", Path("/path/"), ".asc")
command = "./opensearch-signer-client -i " + os.path.join(Path("/path/"), 'the-jar.jar') + " -o " + os.path.join(Path("/path/"), 'the-jar.jar.asc') + " -p pgp"
mock_repo.assert_has_calls(
[call().execute("./opensearch-signer-client -i /path/the-jar.jar -o /path/the-jar.jar.asc -p pgp")])
[call().execute(command)])

@patch("sign_workflow.signer.GitRepository")
def test_signer_sign_sig(self, mock_repo: Mock) -> None:
signer = SignerPGP()
signer.sign("the-jar.jar", Path("/path/"), ".sig")
command = "./opensearch-signer-client -i " + os.path.join(Path("/path/"), 'the-jar.jar') + " -o " + os.path.join(Path("/path/"), 'the-jar.jar.sig') + " -p pgp"
mock_repo.assert_has_calls(
[call().execute("./opensearch-signer-client -i /path/the-jar.jar -o /path/the-jar.jar.sig -p pgp")])
[call().execute(command)])
4 changes: 3 additions & 1 deletion tests/tests_sign_workflow/test_signer_windows.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest
from pathlib import Path
from unittest.mock import MagicMock, Mock, call, patch
Expand Down Expand Up @@ -43,5 +44,6 @@ def test_accepted_file_types(self, git_repo: Mock) -> None:
def test_signer_sign(self, mock_os_mkdir: Mock, mock_os_rename: Mock, mock_repo: Mock) -> None:
signer = SignerWindows()
signer.sign("the-msi.msi", Path("/path/"), ".asc")
command = "./opensearch-signer-client -i " + os.path.join(Path("/path/"), 'the-msi.msi') + " -o " + os.path.join(Path("/path/"), 'signed_the-msi.msi') + " -p windows"
mock_repo.assert_has_calls(
[call().execute("./opensearch-signer-client -i /path/the-msi.msi -o /path/signed_the-msi.msi -p windows")])
[call().execute(command)])

0 comments on commit 1e1a56e

Please sign in to comment.