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

More flexible and useful unit testing. #141

Merged
merged 6 commits into from
Sep 3, 2014

Conversation

dpnova
Copy link
Collaborator

@dpnova dpnova commented Sep 3, 2014

A few things here:

  • The test client now can accept cookies from the server and resubmit them in the next request. This allows signing in via a unit test etc.
  • The CycloneTestCase now has an app_builder class attribute instead of taking the app builder as a param. This allows a declarative set up of the TestCase in code instead of overwriting init in every test case.
  • Unit tests for the sqlite and utils modules.

Cheers!

dpnova and others added 5 commits August 15, 2014 22:57
The doc tests have also been explicitly ommited from the coverage
results.
Also includes some missing tests from escape. They are mostly
pointless but at least exercise the code.
This is to avoid the annoying requirement of overriding __init__
in every test case. For example, this now works:

    class MyTestCase(CycloneTestCase):
        app_builder = MyApplication

        def test_get(self):
            self.client.get("/")

In order to avoid hacky messing with *args, the app_builder can now
only be a kwarg. The relevant test has been updated to the new
behaviour.
This means you can now unit test RequestHandlers that depend on
some cookie state to be set.

Also included is a suitable unit test.
@coveralls
Copy link

Coverage Status

Coverage increased (+4.69%) when pulling 9f0dff1 on dpnova:feature/unittesting into 7ec6058 on fiorix:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+4.71%) when pulling 32c3ed3 on dpnova:feature/unittesting into 7ec6058 on fiorix:master.

fiorix added a commit that referenced this pull request Sep 3, 2014
More flexible and useful unit testing.
@fiorix fiorix merged commit f304653 into fiorix:master Sep 3, 2014
@fiorix
Copy link
Owner

fiorix commented Sep 3, 2014

Thanks!

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.

None yet

3 participants