-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sign.py to only sign specific file types (#303)
Signed-off-by: Marc Handalian <handalm@amazon.com>
- Loading branch information
Showing
5 changed files
with
68 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
# This page intentionally left blank. |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../..")) | ||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../src")) |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import unittest | ||
from unittest.mock import MagicMock, call, patch | ||
|
||
from src.signing_workflow.signer import Signer | ||
|
||
|
||
class TestSigner(unittest.TestCase): | ||
|
||
@patch('src.signing_workflow.signer.GitRepository') | ||
def test_accepted_file_types(self, git_repo): | ||
|
||
artifacts = [ | ||
'bad-xml.xml', | ||
'the-jar.jar', | ||
'the-zip.zip', | ||
'the-war.war', | ||
'the-pom.pom', | ||
'the-module.module', | ||
'the-tar.tar.gz', | ||
'random-file.txt', | ||
] | ||
expected = [ | ||
call('/path/the-jar.jar'), | ||
call('/path/the-zip.zip'), | ||
call('/path/the-war.war'), | ||
call('/path/the-pom.pom'), | ||
call('/path/the-module.module'), | ||
call('/path/the-tar.tar.gz'), | ||
] | ||
signer = Signer() | ||
signer.sign = MagicMock() | ||
signer.sign_artifacts(artifacts, '/path') | ||
self.assertEqual(signer.sign.call_args_list, expected) |