-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds local signing for metadata #451
Adds local signing for metadata #451
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #451 +/- ##
==========================================
+ Coverage 98.90% 99.07% +0.17%
==========================================
Files 20 26 +6
Lines 1367 1844 +477
==========================================
+ Hits 1352 1827 +475
- Misses 15 17 +2 ☔ View full report in Codecov by Sentry. |
bbd972a
to
dc139e2
Compare
|
||
assert test_result.exit_code == 0, test_result.output | ||
assert "Metadata Signed! 🔑" in test_result.output | ||
assert "SIGNING KEYS" in test_result.output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've discussed this name in the table summary SIGNING KEYS
is a bit confusing. Do you have a suggestion here @enyinna1234?
@enyinna1234 it will require a rebase |
This enables the use of a locally stored metadata to create a signature. It also saves the created signature locally. Closes repository-service-tuf#423
dc139e2
to
cb5872d
Compare
@enyinna1234 I spotted a required doc update as part of this PR. repository-service-tuf-cli/docs/source/guide/index.rst Lines 676 to 713 in ff03607
|
with open("tests/files/das-root.json", "r") as file: | ||
das_root = file.read() | ||
fake_offline_md = {"metadata": json.loads(das_root)} | ||
json.load = pretend.call_recorder(lambda *a: fake_offline_md) | ||
json.dump = pretend.call_recorder(lambda *a: "fake_write") | ||
test_result = client.invoke( | ||
metadata.sign, | ||
["tests/files/das-root.json"], | ||
input="\n".join(input_step), | ||
obj=test_context, | ||
catch_exceptions=False, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it more readable, separate function calls of a function you are testing from mocking.
with open("tests/files/das-root.json", "r") as file: | |
das_root = file.read() | |
fake_offline_md = {"metadata": json.loads(das_root)} | |
json.load = pretend.call_recorder(lambda *a: fake_offline_md) | |
json.dump = pretend.call_recorder(lambda *a: "fake_write") | |
test_result = client.invoke( | |
metadata.sign, | |
["tests/files/das-root.json"], | |
input="\n".join(input_step), | |
obj=test_context, | |
catch_exceptions=False, | |
) | |
with open("tests/files/das-root.json", "r") as file: | |
das_root = file.read() | |
fake_offline_md = {"metadata": json.loads(das_root)} | |
json.load = pretend.call_recorder(lambda *a: fake_offline_md) | |
json.dump = pretend.call_recorder(lambda *a: "fake_write") | |
test_result = client.invoke( | |
metadata.sign, | |
["tests/files/das-root.json"], | |
input="\n".join(input_step), | |
obj=test_context, | |
catch_exceptions=False, | |
) |
json.load = pretend.call_recorder(lambda *a: fake_offline_md) | ||
json.dump = pretend.call_recorder(lambda *a: "fake_write") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you add a pretend.call_recorder
you should also check the calls afterwards.
I made the same comment to Ivana before in this comment: #447 (comment)
We need to close this pr as we will towards a new implementation of admin2 signing commands. |
This enables the use of a locally stored metadata to create a signature. It also saves the created signature locally.
Closes #423
Description
Fixes #(issue)
Types of changes
Additional requirements
Code of Conduct
By submitting this PR, you agree to follow our Code of Conduct.