~ahasenack/landscape-client/landscape-client-1.5.5-0ubuntu0.9.04.0

« back to all changes in this revision

Viewing changes to landscape/package/tests/test_interface.py

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2008-09-08 16:35:57 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080908163557-l3ixzj5dxz37wnw2
Tags: 1.0.18-0ubuntu1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
from landscape.package.interface import LandscapeInterface
 
3
 
 
4
from landscape.tests.helpers import LandscapeTest
 
5
from landscape.package.tests.helpers import SmartFacadeHelper
 
6
 
 
7
 
 
8
class LandscapeInterfaceTest(LandscapeTest):
 
9
 
 
10
    helpers = [SmartFacadeHelper]
 
11
 
 
12
    def setUp(self):
 
13
        super(LandscapeInterfaceTest, self).setUp()
 
14
        self.facade.reload_channels()
 
15
        self.iface = LandscapeInterface(None)
 
16
 
 
17
    def test_message_with_unicode_and_utf8(self):
 
18
        self.iface.info(u"áéíóú")
 
19
        self.iface.info("áéíóú")
 
20
        self.assertEquals(self.iface.get_output_for_landscape(),
 
21
                          u"INFO: áéíóú\nINFO: áéíóú\n")
 
22
 
 
23
    def test_message_with_unicode_and_unknown_encoding(self):
 
24
        self.iface.info(u"áéíóú")
 
25
        self.iface.info("aeíou\xc3") # UTF-8 expects a byte after \xc3
 
26
        c = u"\N{REPLACEMENT CHARACTER}"
 
27
        self.assertEquals(self.iface.get_output_for_landscape(),
 
28
                          u"INFO: áéíóú\nINFO: ae%s%sou%s\n" % (c, c, c))
 
29
 
 
30
    def test_output_with_unicode_and_utf8(self):
 
31
        self.iface.showOutput(u"áéíóú")
 
32
        self.iface.showOutput("áéíóú")
 
33
        self.assertEquals(self.iface.get_output_for_landscape(),
 
34
                          u"áéíóúáéíóú")