Closed MarekSuchanek closed 5 years ago
Hi, case
if application reacts to webhook of pull request change (you test only ping) and calls some internal methods appropriately
is now covered.
I also removed deprecation warnings.
Static data are now in helper function.
Hardcoded username in slug should be fixed now also.
P.S case if CLI prints something on output while running and calls some internal methods appropriately
is now covered also, but when I try to pass betamax session to it, I always fail. Do you have any ideas how to pass betamax session to it?
I did something like this:
def test_cli_post_pr(betamax_session):
runner = CliRunner()
config_labels = './test/fixtures/labels.abc.cfg'
config_auth = './test/fixtures/auth.real.cfg'
slug = f'{user}/mi-pyt-test-repo'
filabel.config.session = betamax_session
result = runner.invoke(filabel.cli, ['--config-labels', config_labels, '--config-auth', config_auth, slug])
in config.py:
session = None
and in cli function:
if session:
github = GitHub(config['github']['token'], session)
else:
github = GitHub(config['github']['token'])
If you would recommend me better solution, I'd be glad :)
For passing something via Click, there is a context: http://click.palletsprojects.com/en/7.x/complex/#calling-convention
Or you could mock your internals and just check that CLI does appropriate calls and outputs...
Thank you for recommendation! I changed it that way.
All issues fixed in release v0.4.2.
OK, no new version on PyPI but other is great...
There are some important things uncovered by tests:
Also, you should try to avoid
DeprecationWarning
. You are using parametrized session, where it is not suitable. Long "static data" in code are not nice - it should be in fixtures.When recording my own cassettes, it will make some tests fail probably because you are using hardcoded
j-sokol/mi-pyt-test-repo
...