forked from php-tuf/php-tuf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_fixtures.py
57 lines (50 loc) · 1.44 KB
/
generate_fixtures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# For instructions on using this script, please see the README.
from unittest import mock
import shutil
import glob
import os
from fixtures import (
Simple,
Simple_WithHashes,
AttackRollback,
Delegated,
NestedDelegated,
UnsupportedDelegation,
NestedDelegatedErrors,
ThresholdTwo,
ThresholdTwoAttack,
TerminatingDelegation,
TopLevelTerminating,
NestedTerminatingNonDelegatingDelegation,
ThreeLevelDelegation,
PublishedTwice,
TargetsLengthNoSnapshotLength
)
@mock.patch('time.time', mock.MagicMock(return_value=1577836800))
def generate_fixtures():
Simple.build()
Simple_WithHashes.build()
AttackRollback.build()
Delegated.build()
NestedDelegated.build()
UnsupportedDelegation.build()
NestedDelegatedErrors.build()
ThresholdTwo.build()
ThresholdTwoAttack.build()
TerminatingDelegation.build()
TopLevelTerminating.build()
NestedTerminatingNonDelegatingDelegation.build()
ThreeLevelDelegation.build()
PublishedTwice.build()
PublishedTwice.build(rotate_keys='timestamp')
PublishedTwice.build(rotate_keys='snapshot')
TargetsLengthNoSnapshotLength.build()
# Remove all previous fixtures.
for f in glob.glob("fixtures/**/client"):
shutil.rmtree(f)
for f in glob.glob("fixtures/**/server"):
shutil.rmtree(f)
# Delete hash files to ensure they are generated again.
for f in glob.glob("fixtures/**/hash.txt"):
os.remove(f)
generate_fixtures()