Skip to content

Fix prefix file_prefix to support "" value - #1072

Merged
joshuagl merged 1 commit into
theupdateframework:developfrom
MVrachev:fix-unit-test
Jul 10, 2020
Merged

joshuagl merged 1 commit into
theupdateframework:developfrom
MVrachev:fix-unit-test

Conversation

@MVrachev

@MVrachev MVrachev commented Jul 7, 2020 •

Copy link
Copy Markdown
Collaborator

Fixes issue #: None

Description of the changes being introduced by the pull request:
If we run the tuf unit tests with latest, not yet released,
securesyslib changes we will see that one unit test is failing
because the file_prefix argument should confront the PATH_SCHEMA
(which requires a non-empty string) but an empty string value
is passed to it.

That happens, because in tuf/developer_tool.py create_new_project
function:
https://github.com/theupdateframework/tuf/blob/b309e1befaa1df1df5afd25cd529b5fad3d4b233/tuf/developer_tool.py#L518 the "location_in_repository" arg has a default value of ''
and if not changed when creating a new object of type Project
on line 650:
https://github.com/theupdateframework/tuf/blob/b309e1befaa1df1df5afd25cd529b5fad3d4b233/tuf/developer_tool.py#L650 will cause an exception in the init function
because of the file_prefix argument.

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

If we run the tuf unit tests with latest, not yet released,
securesyslib changes we will see that one unit test is failing
because the file_prefix argument should confront the PATH_SCHEMA
(which requires a non-empty string) but an empty string value
is passed to it.

That happens, because in tuf/developer_tool.py create_new_project
function the "location_in_repository" arg has a default value of ''
and if not changed when creating a new object of type Project
on line 650 will cause an exception in the __init__ function
because of the file_prefix argument.

Signed-off-by: Martin Vrachev <[email protected]>

@joshuagl joshuagl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch Martin!

@joshuagl
joshuagl merged commit 284ff1c into theupdateframework:develop Jul 10, 2020
@joshuagl joshuagl mentioned this pull request Aug 4, 2020
3 tasks
@MVrachev
MVrachev deleted the fix-unit-test branch August 4, 2020 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants