user2200321
user2200321

Reputation: 445

How to run unittests on Google App Engine app?

I was reading this guide on Google's app engine page, and created the following code to test my submission handler:

class CreatePostsTest(unittest.TestCase):
    def setUp(self):
        app = webapp2.WSGIApplication([('/',Submit)])
        self.testapp = webtest.TestApp(app)

    def testSubmit(self):   
        response = self.testapp.post('/',{'title':'testpost','body':'this is a body'})
        self.assertEqual(response.status_int,200)

Sorry if this is a stupid question, but how do I run the unittest?

Thanks!

Upvotes: 0

Views: 36

Answers (1)

Tim Hoffman
Tim Hoffman

Reputation: 12986

The answer is in one of the articles linked to by the guide you where reading.

See the last section of https://developers.google.com/appengine/docs/python/tools/localunittesting#Python_Introducing_the_Python_testing_utilities

Upvotes: 1

Related Questions