Skip to content

Commit

Permalink
Merge pull request #739 from kids-first/fix-faketemplates-cmd
Browse files Browse the repository at this point in the history
🐛 Delete templates in faketemplates cmd if flag is given
  • Loading branch information
znatty22 authored Sep 1, 2021
2 parents 4b6c158 + ee09f89 commit 0131710
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def add_arguments(self, parser):
)
parser.add_argument(
"--delete",
action='store_false',
action='store_true',
help="Delete all templates in the organization before creating "
" new ones",
)
Expand Down
6 changes: 3 additions & 3 deletions tests/data_templates/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_faketemplates(db, mocker, tmpdir):
org = OrganizationFactory()
management.call_command("faketemplates", org.name)
msgs = [call.args[0] for call in mock_logger.info.call_args_list]
assert "Deleted" in "\n".join(msgs)
assert "Deleted" not in "\n".join(msgs)
mock_create_templates.assert_called_with(TEMPLATES_PATH, org)

for mock in [mock_create_templates, mock_logger]:
Expand All @@ -49,10 +49,10 @@ def test_faketemplates(db, mocker, tmpdir):
with open(fp, "w") as package_file:
package_file.write("the package")
management.call_command(
"faketemplates", org.name, delete=False, template_package=fp
"faketemplates", org.name, delete=True, template_package=fp
)
msgs = [call.args[0] for call in mock_logger.info.call_args_list]
assert "Deleted" not in "\n".join(msgs)
assert "Deleted" in "\n".join(msgs)
mock_create_templates.assert_called_with(fp, org)


Expand Down

0 comments on commit 0131710

Please sign in to comment.