Test creating tags through the CLI

This commit is contained in:
Xavier Bustamante Talavera 2018-09-07 12:52:04 +02:00
parent 804a696390
commit 4bb2850423
1 changed files with 10 additions and 0 deletions

View File

@ -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.add(Tag(id='foo-bar', org=org2))
db.session.commit() db.session.commit()
user.get(res=Tag, item='foo-bar/device', status=MultipleResourcesFound) 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()