~ubuntu-branches/ubuntu/quantal/ubuntu-release-upgrader/quantal-proposed

« back to all changes in this revision

Viewing changes to tests/test_view.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2012-10-19 09:30:36 UTC
  • Revision ID: package-import@ubuntu.com-20121019093036-ba3xeqjdpwgjhljh
Tags: 1:0.190.2
fix unicode releated crash in non-english locales (LP: #1068389)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python3
 
2
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
 
3
 
 
4
from __future__ import unicode_literals
 
5
 
 
6
import os
 
7
import tempfile
 
8
import unittest
 
9
 
 
10
from DistUpgrade.DistUpgradeViewText import DistUpgradeViewText
 
11
 
 
12
 
 
13
class TestDistUpradeView(unittest.TestCase):
 
14
 
 
15
    def test_show_in_pager_lp1068389(self):
 
16
        """Regression test for LP: #1068389"""
 
17
        output = tempfile.NamedTemporaryFile()
 
18
        os.environ["PAGER"] = "less -F -O%s" % output.name
 
19
        v = DistUpgradeViewText()
 
20
        v.showInPager("äää")
 
21
        with open(output.name, "rb") as fp:
 
22
            self.assertEqual(fp.read().decode("utf-8"), "äää")
 
23
 
 
24
if __name__ == "__main__":
 
25
    unittest.main()