@@ -0,0 +1,1396 @@
+from mock import Mock%0Afrom urllib.parse import urlencode%0A%0Afrom tornado.testing import AsyncHTTPTestCase%0Afrom qiita_pet.webserver import Application%0A%0Afrom platemap.handlers.base import BaseHandler%0Aimport platemap as pm%0A%0A%0Aclass TestHandlerBase(AsyncHTTPTestCase):%0A    database = False%0A    app = Application()%0A%0A    def get_app(self):%0A        BaseHandler.get_current_user = Mock(%0A            return_value=pm.person.User('User1'))%0A        self.app.settings%5B'debug'%5D = False%0A        return self.app%0A%0A    # helpers from http://www.peterbe.com/plog/tricks-asynchttpclient-tornado%0A    def get(self, url, data=None, headers=None, doseq=True):%0A        if data is not None:%0A            if isinstance(data, dict):%0A                data = urlencode(data, doseq=doseq)%0A            if '?' in url:%0A                url += '&amp;%25s' %25 data%0A            else:%0A                url += '?%25s' %25 data%0A        return self._fetch(url, 'GET', headers=headers)%0A%0A    def post(self, url, data, headers=None, doseq=True):%0A        if data is not None:%0A            if isinstance(data, dict):%0A                data = urlencode(data, doseq=doseq)%0A        return self._fetch(url, 'POST', data, headers)%0A%0A    def _fetch(self, url, method, data=None, headers=None):%0A        self.http_client.fetch(self.get_url(url), self.stop, method=method,%0A                               body=data, headers=headers)%0A        return self.wait(timeout=10)%0A

add tornado test base