python-tuf/tests
Lukas Puehringer f63dce6ddd Refactor metadata constructors and add factory
This commit better separates the Metadata class model from the
Metadata wireline format, by tailoring the constructors
towards class-based parameters and adding an additional
factory classmethod that creates Metadata objects based on the
wireline json/dictionary metadata representation. (pythonic
way of constructor overloading).

This 'from_dict' factory method recurses into the 'from_dict'
methods of each contained complex field/attribute that is also
represented by a class. Currently 'signed' is the only such
attribute.

This commit further:
- Changes optional constructor keyword arguments to mandatory
positional arguments: Reduces code and simplifies usage by
restricting it. For now, users are unlikely to call
constructor directly anyway, but the 'from_dict' factory (or
its 'from_json_file' wrapper) instead.

- Removes Signed.__expiration (datetime) vs. Signed.expires
(datestring) dichotomy: Keeping only one representation of the
same attribute in memory makes the interface simpler and less
ambiguous. We choose the datetime object, because it is more
convenient to modify. Transformation from and to the string
format required by the tuf wireline format is performed in the
corresponding metadata de/serialization methods, i.e.
('to_dict' and 'from_dict').

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-09-10 16:18:28 +02:00
..
repository_data Remove redundant test logic 2020-05-12 22:16:38 +01:00
ssl_certs Test: add https test with expired server certificate 2018-09-26 14:15:36 -04:00
.coveragerc Move omit to run section in .coveragerc 2019-07-11 14:32:49 +02:00
__init__.py Support ISO 8601, vendor iso8601, clean codebase. 2014-04-19 14:27:53 -04:00
aggregate_tests.py Install TUF in editable mode in tox builds 2019-07-11 14:32:49 +02:00
proxy_server.py fix-up tests package word spelling mistake 2019-08-30 22:31:00 +08:00
simple_https_server.py Test: add proxy certs and reorganize certs in test data dir 2018-09-21 13:13:52 -04:00
simple_server.py Remove six.PY2 and platform checks and add warning 2020-05-07 18:06:09 +03:00
slow_retrieval_server.py DOC: Clarify and correct comments on download timeouts 2018-09-10 16:30:32 -04:00
test_api.py Refactor metadata constructors and add factory 2020-09-10 16:18:28 +02:00
test_arbitrary_package_attack.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_developer_tool.py Port to new securesystemslib w abstract filesystem 2020-05-12 22:16:50 +01:00
test_download.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_endless_data_attack.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_exceptions.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_extraneous_dependencies_attack.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_formats.py Remove deprecated securesystemslib.formats schemas 2019-09-17 10:28:10 +01:00
test_indefinite_freeze_attack.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_init.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_key_revocation_integration.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_keydb.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_log.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_mirrors.py Minor cosmetic change to URL creation 2018-04-20 10:57:30 -04:00
test_mix_and_match_attack.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_multiple_repositories_integration.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_proxy_use.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_replay_attack.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00
test_repository_lib.py Support abstract storage for timestamp metadata 2020-06-03 14:16:47 +01:00
test_repository_tool.py Update test_load_repository 2020-06-09 16:48:53 +03:00
test_roledb.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_root_versioning_integration.py Port to new securesystemslib w abstract filesystem 2020-05-12 22:16:50 +01:00
test_sig.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_slow_retrieval_attack.py Remove unused imports 2020-06-04 19:18:33 -05:00
test_tutorial.py Update TUTORIAL and test_tutorial 2020-04-08 18:58:27 +03:00
test_unittest_toolbox.py Use __name__ for loggers, per convention 2020-03-03 10:36:39 +00:00
test_updater.py Port to new securesystemslib w abstract filesystem 2020-05-12 22:16:50 +01:00
test_updater_root_rotation_integration.py Remove PIPE arg and make QuiteHandler the default 2020-05-07 15:53:01 +03:00