Commit graph

10 commits

Author SHA1 Message Date
Sebastien Awwad
bfcdfd5c5a Test: Correctly test target addition in tutorial despite #774
(that is, despite currently existing issue to be remedied in #774)

Currently, repository_tool.get_filepaths_in_directory yields
relative paths, not the absolute paths it promises in its docstring.
This test will now function despite this and continue to function
after #774 is merged.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
6c850e062b Test: correctly test use of non-TUF-generated signatures in tutorial
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
8e22de5842 Correct remove_target() call in TUTORIAL.md and test_tutorial.py
Target removal is done relative to the root of the targets dir.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
3a37189e69 Use os.path.join instead of '/' in test_tutorial.py for compat
for compatibility with non-Linux environments.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
e24525c94c In repo tutorial, fix consistent snapshots instructions
to include loading the root signing keys and explaining why.

Also update test_tutorial.py

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
608e377d83 Exclude leading '/' for target fnames in tutorial and its tester
Because leading '/' is no longer allowed in target filenames in
target addition or delegation.

See https://github.com/theupdateframework/tuf/issues/639

While we're at it, remove some other unnecessary '/' characters
in repository creation and loading in the tutorial and tutorial
test.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
b947a6bd48 Have test_tutorial.py copy metadata.staged to metadata
in order to allow testing of client creation script

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
56f14c4342 Remove add_restricted_paths from TUTORIAL.md and test_tutorial.py
add_restricted_paths was renamed to add_path; however, this
function represents a problematic element of TUF that assumes
that roles are have a single delegator and delegatee, and that
one can refer to a role's expected keys without being concerned
about any delegation metadata....

So this is being removed from the tutorial. In time, add_paths
will either be removed or changed (to expect a delegator role
and a delegatee role, not just a delegatee role).

This comment does not do justice to the issue: please see TUF
GitHub Issue #660:
https://github.com/theupdateframework/tuf/issues/660

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
e2ec3ef158 Remove keystore/ use from TUTORIAL.md and test_tutorial
While it may be nice, the use of a keystore/ directory for the
temporary keys created in the tutorial complicates the code a
good bit when it's done in a portable way (tons of os.path.join()
calls), and that's not worth it. It also is a slight complication
in a tutorial that profits from being as simple as possible.

Tests will be run in multiple environments (including non-Linux
environments) and to leave so many extra subdirectory uses in the
tutorial means that the tutorial test will deviate over a large
number of lines from the TUTORIAL.md content it is intended to
test, which would be bad.

This commit adjusts both the tutorial doc and the regression test
for the tutorial.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00
Sebastien Awwad
2d2c527b74 Add a regression test for the tutorial instructions
running test_tutorial.py attempts the commands replicated from
TUTORIAL.md. This should help us avoid breaking the tutorial with
future changes without noticing by having automated testing run
the tutorial and produce helpful output.

NOTE that this test currently fails because the tutorial is
currently broken!

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-12-16 15:16:24 +01:00