~juju/ubuntu/quantal/juju/0.6

« back to all changes in this revision

Viewing changes to juju/lib/tests/test_under.py

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-10-09 09:50:34 UTC
  • mto: (10.1.1 precise)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20111009095034-wqzww7z4tx2n0x43
Tags: upstream-0.5+bzr398
ImportĀ upstreamĀ versionĀ 0.5+bzr398

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import string
 
2
 
 
3
from juju.lib.testing import TestCase
 
4
from juju.lib.under import quote
 
5
 
 
6
 
 
7
class UnderTest(TestCase):
 
8
 
 
9
    def test_unmodified(self):
 
10
        s = string.ascii_letters + string.digits + "-."
 
11
        q = quote(s)
 
12
        self.assertEquals(quote(s), s)
 
13
        self.assertTrue(isinstance(q, str))
 
14
 
 
15
    def test_quote(self):
 
16
        s = "hello_there/how'are~you-today.sir"
 
17
        q = quote(s)
 
18
        self.assertEquals(q, "hello_5f_there_2f_how_27_are_7e_you-today.sir")
 
19
        self.assertTrue(isinstance(q, str))
 
20
 
 
21
    def test_coincidentally_unicode(self):
 
22
        s = u"hello_there/how'are~you-today.sir"
 
23
        q = quote(s)
 
24
        self.assertEquals(q, "hello_5f_there_2f_how_27_are_7e_you-today.sir")
 
25
        self.assertTrue(isinstance(q, str))
 
26
 
 
27
    def test_necessarily_unicode(self):
 
28
        s = u"hello\u1234there"
 
29
        self.assertRaises(KeyError, quote, s)