Skip to content

implemented NetwellResponse - #7

Open
Smarties89 wants to merge 2 commits into
pennersr:masterfrom
Smarties89:feature/response_asserter
Open

implemented NetwellResponse#7
Smarties89 wants to merge 2 commits into
pennersr:masterfrom
Smarties89:feature/response_asserter

Conversation

@Smarties89

Copy link
Copy Markdown

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
Copy Markdown
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