Skip to content

Commit 1fe4172

Browse files
committed
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 <[email protected]>
1 parent 993dd91 commit 1fe4172

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

docs/TUTORIAL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ new metadata to disk.
428428

429429
# Remove a target file listed in the "targets" metadata. The target file is
430430
# not actually deleted from the file system.
431-
>>> repository.targets.remove_target("repository/targets/file3.txt")
431+
>>> repository.targets.remove_target('file3.txt')
432432

433433
# repository.writeall() writes any required metadata files (e.g., if
434434
# targets.json is updated, snapshot.json and timestamp.json are also written

tests/test_tutorial.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@
99
1010
<Purpose>
1111
Regression test for the TUF tutorial as laid out in TUTORIAL.md.
12-
This simply runs the tutorial and checks some results.
12+
This essentially runs the tutorial and checks some results.
13+
14+
There are a few deviations from the TUTORIAL.md instructions:
15+
- steps that involve user input (like passphrases) are modified slightly
16+
to not require user input
17+
- use of path separators '/' is replaced by join() calls. (We assume that
18+
when following the tutorial, users will correctly deal with path
19+
separators for their system if they happen to be using non-Linux systems.)
20+
- shell instructions are mimicked using Python commands
21+
1322
"""
1423

1524
# Help with Python 3 compatibility, where the print statement is a function, an
@@ -241,7 +250,7 @@ def test_tutorial(self):
241250

242251
repository.writeall()
243252

244-
repository.targets.remove_target("repository/targets/file3.txt")
253+
repository.targets.remove_target('file3.txt')
245254
self.assertTrue(os.path.exists(os.path.join(
246255
'repository','targets', 'file3.txt')))
247256

0 commit comments

Comments
 (0)