From 4bb285042357d748aa30998f78508bdd37b53642 Mon Sep 17 00:00:00 2001 From: Xavier Bustamante Talavera Date: Fri, 7 Sep 2018 12:52:04 +0200 Subject: [PATCH] Test creating tags through the CLI --- tests/test_tag.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_tag.py b/tests/test_tag.py index a8cf5c72..0342a904 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -120,3 +120,13 @@ def test_tag_get_device_from_tag_endpoint_multiple_tags(app: Devicehub, user: Us db.session.add(Tag(id='foo-bar', org=org2)) db.session.commit() user.get(res=Tag, item='foo-bar/device', status=MultipleResourcesFound) + + +def test_tag_create_tags_cli(app: Devicehub, user: UserClient): + """Checks creating tags with the CLI endpoint.""" + runner = app.test_cli_runner() + runner.invoke(args=['create-tags', 'id1'], catch_exceptions=False) + with app.app_context(): + tag = Tag.query.one() # type: Tag + assert tag.id == 'id1' + assert tag.org.id == Organization.get_default_org_id()