Commit graph

29 commits

Author SHA1 Message Date
Martin Vrachev
028d1bc9f7 Make "utils" import more definite
Currently, we are importing the "utils" module in tests/utils
with "import utils".
This could become a problem when there is another module with
the same general name "utils" and could lead to import mistakes.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-11-23 22:17:31 +02:00
Martin Vrachev
7f885d2160 Remove redundant comments from test classes
I don't see a need to leave a comment about what setupClass,
tearDownClass, setup and tearDown functions do.
There is documentation that describes that.
Additionally, the links referenced in the comments are from
Python 2 is deprecated.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-10-01 12:22:19 +03:00
Jussi Kukkonen
03b15fb4be tests: Configure logging for all test files
all test_*.py files now accept zero or more '-v' to increase tuf
logging level. The default is now ERROR.

default: ERROR
"-v":    ERROR, but unittest prints test names
"-vv":   WARNING
"-vvv":  INFO
"-vvvv": DEBUG

Example to run a single test with DEBUG level:
  python3 test_updater.py -vvvv TestUpdater.test_4_refresh

Also make test_log.py restore the log level it modifies during test.

Fixes #1093

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-09-15 21:36:50 +03:00
Jussi Kukkonen
b6661e024a tests: Remove unused imports
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Joshua Lock
0c0aaa97eb Port to new securesystemslib w abstract filesystem
Switch to using the new abstract files and directories support in
securesystemslib by taking an object which implements
securesystemslib.storage.StorageBackendInterface in the Repository
constructor, passed in by tuf.repository_tool.create_new_repository() and
tuf.repository_tool.load_repository()

The Updater class in tuf.client.updater does not specify a storage backend
and instead allows the functions in securesystemslib to perform the
default action of instantiating a LocalFilesystemBackend, that is the
updater does not currently support abstract filesystem backends and always
defaults to using local storage.

Finally we drop support for tuf.settings.CONSISTENT_METHOD as it's not as
clear how different copying modes should work when the details of the
underlying storage are abstracted away.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-05-12 22:16:50 +01:00
Joshua Lock
292b18926b Use __name__ for loggers, per convention
Replace hard-coded logger names with __name__. For the most part this just uses
the standard conventions to create the same logger hierarchy as existed before.
The only real difference is that loggers created for printing during tests are
no longer part of the 'tuf' hierarchy.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-03-03 10:36:39 +00:00
Sebastien Awwad
a9d7053d78 Use TUF exceptions instead of SSL exceptions where appropriate
Removal of securesystemslib exceptions that are TUF-specific
occurs in securesystemslib PR #165
https://github.com/secure-systems-lab/securesystemslib/pull/165

This commit adapts to those changes.  Exceptions that are specific
to TUF should be in TUF and not in securesystemslib.  This commit
uses those already-existing TUF exceptions instead of pointing to
securesystemslib exceptions that will be removed.

For example, securesystemslib has no notion of repositories, so
it's ridiculous to have a RepositoryError in securesystemslib and
ridiculous for TUF to use
securesystemslib.exceptions.RepositoryError.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-09-17 11:19:04 +02:00
Vladimir Diaz
9048b793f4
Modify test condition for OSError
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-04-27 13:36:16 -04:00
Vladimir Diaz
76ec9639f9
Remove chmod from test condition
chmod() is not fully supported in Windows.  Instead, use the '/' directory to trigger a non-EEXIST exception for the test condition

Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-04-27 11:15:14 -04:00
Vladimir Diaz
02982b4b98
Remove duplicate LOC in test_developer_tool.py
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-04-23 10:56:10 -04:00
Vladimir Diaz
24a0cec633
Update unit tests affected by change to target filepaths
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-04-06 13:18:33 -04:00
Vladimir Diaz
8f65fa4154
Rename license files in modules
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-02-05 11:31:19 -05:00
Vladimir Diaz
f2514bdc4d
Add copyright and license to test-related files
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2017-11-30 13:33:11 -05:00
Vladimir Diaz
8da3857551
Edit unit test for developer_tool after changes
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2017-11-27 11:38:49 -05:00
Vladimir Diaz
72d7ebfd8d
Remove py26 conditional import statements 2017-09-21 17:16:29 -04:00
Vladimir Diaz
d5f933b18d
Remove compression from developer_tool.py's unit test 2017-08-25 17:04:50 -04:00
Vladimir Diaz
4abe845daf Fix import statements in various test modules 2017-01-11 17:05:46 -05:00
Vladimir Diaz
b1367430d7 Replace instances of tufformats in test modules 2016-11-09 17:10:05 -05:00
Artiom Baloian
299ff68edd Now crypto related files are in ssl_crypto and ssl_commons 2016-11-02 17:44:32 -04:00
Artiom Baloian
8247a02737 Moved TuF exceptions and schem into the ssl_commons 2016-10-31 11:58:05 -04:00
Artiom Baloian
7098cdbc3a Move _vendor dir and split formats into the formats and tufformats 2016-10-28 18:37:28 -04:00
Vladimir Diaz
a59008cf2b Use the 'clear_all' argument with clear_roledb.py and clear_keydb.py 2016-07-15 15:24:45 -04:00
Vladimir Diaz
5c7333b062 Fix unit tests for developer_tool.py 2016-07-01 12:52:04 -04:00
Vladimir Diaz
e27371113f Update developer tool 2016-04-14 16:53:48 -04:00
Vladimir Diaz
18844f6453 Initial refactor of developer tool 2016-04-05 20:23:37 -04:00
Vladimir Diaz
1985c450c9 Merge custom info changes, logger messages, and minor edits. 2014-07-02 11:10:50 -04:00
vladdd
2f520dd140 Review and update pull request #188. 2014-06-30 14:04:01 -04:00
Santiago Torres
26eb5b7e35 Added relative filepath support and increased coverage
After seeing the coveralls report I realized the projects were not
relocatable. While this might be convenient for some uses, moving a
project from one place to another might not be optimal. This has been
changed now.

The only place where absolute filepaths are handled now is with flat
project layouts. However, it is possible to overwrite this filepath if
the targets folder is to be changed.
2014-06-21 19:07:34 -04:00
Santiago Torres
f9ce4fcb36 Added the test_developer_tool module
All of the neccessary test cases for the developer tool
2014-06-20 19:39:11 -04:00