review/tests/test_web.py @ b443b42afe6f issue-90

Convert unicode to ascii for mercurial API.

Mercurial API can't work with python's Unicode objects.
Details http://mercurial.selenic.com/wiki/EncodingStrategy#Unicode_strings
author Alexander Stepanenko <olexander314@gmail.com>
date Mon, 15 Dec 2014 02:06:13 +0300
parents 8be7ac46f0ec
children (none)
import unittest

from nose.tools import eq_

import util

from .. import web

NON_EXISTENT_REV = 999999

class WebTestCase(unittest.TestCase):
    """Simple web tests. Currently only checks for correct status codes."""

    def setUp(self):
        util.setup_reviewed_sandbox()()
        ui = util.get_ui()
        repo = util.get_sandbox_repo()
        web._configure_app(ui, repo)
        web.app.config['TESTING'] = True
        self.app = web.app.test_client()

    def tearDown(self):
        util.teardown_sandbox()

    def test_index_no_rev(self):
        rv = self.app.get('/')
        eq_(rv.status_code, 200)

    def test_index_high_rev(self):
        rv = self.app.get('/%s/' % NON_EXISTENT_REV)
        eq_(rv.status_code, 200)

    def test_index_known_rev(self):
        rv = self.app.get('/0/')
        eq_(rv.status_code, 200)

if __name__ == '__main__':
    unittest.main()