web/test/unittest_http_headers.py
author Rémi Cardona <remi.cardona@logilab.fr>
Wed, 22 Apr 2015 12:05:09 +0200
changeset 10319 0d3ede4865a8
parent 10072 934341b848a6
permissions -rw-r--r--
[web/test] Fix broken tests after commit b81adb5e32f9 Add missing n3rdf view to RDF view list.

import unittest

from cubicweb.web import http_headers


class TestGenerators(unittest.TestCase):
    def test_generate_true_false(self):
        for v in (True, 1, 'true', 'True', 'TRUE'):
            self.assertEqual('true', http_headers.generateTrueFalse(v))
        for v in (False, 0, 'false', 'False', 'FALSE'):
            self.assertEqual('false', http_headers.generateTrueFalse(v))

        with self.assertRaises(ValueError):
            http_headers.generateTrueFalse('any value')

if __name__ == '__main__':
    from unittest import main
    main()