Commit graph

18 commits

Author SHA1 Message Date
1seal
d5fa0b0594 address review feedback: remove redundant root.json writes, rename docs section
Signed-off-by: 1seal <security@1seal.org>
2026-02-19 14:46:40 +01:00
1seal
c49bdb9322 feat(ngclient): require explicit bootstrap argument
make bootstrap required and explicit: callers must pass bootstrap=<root_bytes> or bootstrap=None.

also tighten docs, examples, and tests to reflect the explicit trust anchor choice.

Signed-off-by: 1seal <security@1seal.org>
2026-01-25 11:58:09 +00:00
Jussi Kukkonen
f35b237739 tests: Make tests cope with root history in local cache
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2025-02-20 11:00:50 +02:00
Jussi Kukkonen
1d81a04707 Use __future.annotations module
This allows using some more nice annotations from 3.10
while still being compatible with even Python 3.8.

These are all annotation changes, should not modify any functionality.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-11-29 12:41:09 +02:00
NicholasTanz
5c71f4f062 update python annotations
Signed-off-by: NicholasTanz <nicholastanzillo@gmail.com>
2024-11-03 23:21:23 -05:00
Jussi Kukkonen
9a61be1bf4 lint: Enable flake8-executable
* Remove exectuable flag from a couple of files
* Half of the test files have a shebang (but are
  still not executable): remove the shebang

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
E3E
f156e21537 remove pylint and suppressed inline errors from pylint
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-20 22:57:53 -05:00
Teodora Sechkova
2562aff00b
Fix linter errors in tests
Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-15 12:14:20 +02:00
Teodora Sechkova
1ba93015c3
Add --dump option to tests
Extend updater tests with the option to dump repository
metadata locally.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-15 12:12:34 +02:00
Teodora Sechkova
74dddf02c3
Improve clean up in subtests
Use a "try" block to catch exceptions during failing
subtests and always execute the subtest clean up code.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-10 16:04:51 +02:00
Teodora Sechkova
c77b47ee82
Modify RepositorySimulator.add_delegation
Reduce the number of function arguments and use
DelegatedRole instead.

When adding a list of delegations to the repository,
move the Targets creation inside the loop to create
a separate Targets object for each delegation.

Create a new Metadata obgect only for delegated roles
which do not exist yet in the repository.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-10 16:04:48 +02:00
Teodora Sechkova
568580701c
tests: move _cleanup_dir to utils.py
Make the method _cleanup_dir public and move it
to tests/utils.py.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-10 15:59:51 +02:00
Teodora Sechkova
bdf1cbbbb5
Merge pull request #1715 from jku/tests-sim-updater-bootstrap
tests: Refactor client bootstrap
2021-12-10 13:06:53 +02:00
Martin Vrachev
5aa547d6b6 Address more mypy warnings on tests files
All of the changes are made manual.
The target files are only those who test the new code.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2021-12-09 16:44:24 +02:00
Martin Vrachev
8d73330f86 Address more pylint warnings on tests files
All of the changes are made manual.
The target files are only those who test the new code.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2021-12-09 16:13:14 +02:00
Jussi Kukkonen
b34d1b494e tests: Refactor client bootstrap
Setting up the client (when using RepositorySimulator) can be a bit
cleaner.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2021-12-09 09:45:45 +02:00
Kairo de Araujo
35cbc3e21e Implemented fetch_tracker to RepositorySimulator
This commit implements a feature in Repository Simulator to
track the fetch calls to the metadata and targets. This feature was
mentioned in PR #1666 that generated issue #1682.
This commit adds RepositorySimulator.fetch_tracker. It also changes
the tests/test_updater_consistent_snapshot.py to use the
fetch_tracker instead of using mock.

It implements a dataclass that stores the calls to fetch metadata
(_fetch_metadata) in fetch_tracker.metadata and targets
(_fetch_targets) in fetch_tracker.targets.

The fetch calls for metadata, and targets are stored as lists.

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2021-12-08 09:57:38 +01:00
Teodora Sechkova
a72fa62906
ngtests: Add consistent_snapshot tests
Add tests for ngclient.Updater toggling
'consitent_snapshot' and 'prefix_targets_with_hash'.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-11-18 11:14:12 +02:00