bugfix tag test with cli
This commit is contained in:
parent
9e57b0aee7
commit
1a6afe29d3
|
@ -66,6 +66,7 @@ class TagDef(Resource):
|
||||||
)))
|
)))
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@option('-u', '--owner', help=OWNER_H)
|
||||||
@option('--org', help=ORG_H)
|
@option('--org', help=ORG_H)
|
||||||
@option('--provider', help=PROV_H)
|
@option('--provider', help=PROV_H)
|
||||||
@argument('path', type=cli.Path(writable=True))
|
@argument('path', type=cli.Path(writable=True))
|
||||||
|
|
|
@ -147,8 +147,9 @@ def test_tag_get_device_from_tag_endpoint_multiple_tags(app: Devicehub, user: Us
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
def test_tag_create_tags_cli(app: Devicehub, user: UserClient):
|
def test_tag_create_tags_cli(app: Devicehub, user: UserClient):
|
||||||
"""Checks creating tags with the CLI endpoint."""
|
"""Checks creating tags with the CLI endpoint."""
|
||||||
|
owner_id = user.user['id']
|
||||||
runner = app.test_cli_runner()
|
runner = app.test_cli_runner()
|
||||||
runner.invoke('tag', 'add', 'id1')
|
runner.invoke('tag', 'add', 'id1', '-u', owner_id)
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
tag = Tag.query.one() # type: Tag
|
tag = Tag.query.one() # type: Tag
|
||||||
assert tag.id == 'id1'
|
assert tag.id == 'id1'
|
||||||
|
@ -159,8 +160,10 @@ def test_tag_create_tags_cli(app: Devicehub, user: UserClient):
|
||||||
def test_tag_create_etags_cli(app: Devicehub, user: UserClient):
|
def test_tag_create_etags_cli(app: Devicehub, user: UserClient):
|
||||||
"""Creates an eTag through the CLI."""
|
"""Creates an eTag through the CLI."""
|
||||||
# todo what happens to organization?
|
# todo what happens to organization?
|
||||||
|
owner_id = user.user['id']
|
||||||
runner = app.test_cli_runner()
|
runner = app.test_cli_runner()
|
||||||
runner.invoke('tag', 'add', '-p', 'https://t.ereuse.org', '-s', 'foo', 'DT-BARBAR')
|
args = ('tag', 'add', '-p', 'https://t.ereuse.org', '-s', 'foo', 'DT-BARBAR', '-u', owner_id)
|
||||||
|
runner.invoke(*args)
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
tag = Tag.query.one() # type: Tag
|
tag = Tag.query.one() # type: Tag
|
||||||
assert tag.id == 'dt-barbar'
|
assert tag.id == 'dt-barbar'
|
||||||
|
@ -234,9 +237,10 @@ def test_tag_secondary_workbench_link_find(user: UserClient):
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
def test_tag_create_tags_cli_csv(app: Devicehub, user: UserClient):
|
def test_tag_create_tags_cli_csv(app: Devicehub, user: UserClient):
|
||||||
"""Checks creating tags with the CLI endpoint using a CSV."""
|
"""Checks creating tags with the CLI endpoint using a CSV."""
|
||||||
|
owner_id = user.user['id']
|
||||||
csv = pathlib.Path(__file__).parent / 'files' / 'tags-cli.csv'
|
csv = pathlib.Path(__file__).parent / 'files' / 'tags-cli.csv'
|
||||||
runner = app.test_cli_runner()
|
runner = app.test_cli_runner()
|
||||||
runner.invoke('tag', 'add-csv', str(csv))
|
runner.invoke('tag', 'add-csv', str(csv), '-u', owner_id)
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
t1 = Tag.from_an_id('id1').one()
|
t1 = Tag.from_an_id('id1').one()
|
||||||
t2 = Tag.from_an_id('sec1').one()
|
t2 = Tag.from_an_id('sec1').one()
|
||||||
|
|
Reference in New Issue