Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented NetwellResponse #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Smarties89
Copy link

I have implemented NetwellResponse, that makes it simpler to assert contains, contains not etc.
(This is in response to #6 )
I implemented URl('...').response as a method as we discussed.
But I realised that it breaks backward compatibility (you can't use URL('...').response anymore.
Should I change it to be a simple property like before but with the included contains, ... methods?

PS.
To make life easier for you I included the script I tested it with:

from netwell.checkers import URL


# Should be ok
URL('https://www.gnu.org/licenses/gpl.txt').response().contains('GNU')

# Should return error
URL('https://www.gnu.org/licenses/gpl.txt').response().contains('Windows rocks')

# Should be ok
URL('https://www.gnu.org/licenses/gpl.txt').response().not_contains('Windows rocks')

# Should return error
URL('https://www.gnu.org/licenses/gpl.txt').response().not_contains('GNU')


def succeed_check(response, outcome):
    data = response.text
    if 'GNU' not in data:
        outcome.fail('Other data expected')


URL('https://www.gnu.org/licenses/gpl.txt').response().check(succeed_check)

@Smarties89
Copy link
Author

Implementing response as a method instead of a simple wrapper created far reaching backward incompatibilities. Every custom check would stop working. Therefore I hope you came to the same resolution and also thought it would be a good idea to implement it as a simple wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant