HalfDeadPie / Yum4FIT

The application for increasing cooking skills for academic purposes. To test this application you need to create new Instagram profile or and set environment variables TEST_USERNAME and TEST_PASSWORD. Also, you need to set Application ID and Application Key in test configuration file in tests/fixtuers/config/
MIT License
0 stars 0 forks source link

Testovanie click commands #6

Closed HalfDeadPie closed 6 years ago

HalfDeadPie commented 6 years ago
@click.group('yum')
@click.option('--config', '-c', default='config.cfg',
help='Path of the auth config file.')
@click.option('--username', '-u', envvar='IG_USERNAME',
help='Instagram username')
@click.option('--password', '-p', envvar='IG_PASSWORD',
help='Instagram password')
@click.pass_context
def cli(ctx, config, username, password):
...

@cli.command()
@click.option('--id', '-i', help='XP Gain from the photo with ID')
@click.pass_context
def gain(ctx, id):
....

Chcel by som sa spytat, ci je mozne otestovat prikaz yum gain bez options, cize moj problem je, ze neviem zavolat podprikaz gain z group commandu yum

runner = CliRunner() result = runner.invoke(cli, ['gain']) nefunguje

V oficialnej dokumentacii a ani v click core.py som odpoved nenasiel, dakujem.

MarekSuchanek commented 6 years ago

Mělo by to jít... co to hází za chybu?

Takhle mě napadá jedině, že chybí nastavit obj v ctx...

result = runner.invoke(cli, ['gain'], obj={})
HalfDeadPie commented 6 years ago

Zabralo, ďakujem. Neuvedomil som si, ze to treba nastavovat, aj ked nechavam obj prazdne