~ubuntu-branches/ubuntu/natty/aptdaemon/natty-security

« back to all changes in this revision

Viewing changes to tests/regressions/test_lp724735.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2011-04-12 13:25:49 UTC
  • mfrom: (1.1.47 upstream)
  • Revision ID: james.westby@ubuntu.com-20110412132549-8rc74dfr01jil7vm
Tags: 0.41+bzr629-0ubuntu1
* New bzr bugfix snapshot:
  - improve utf8 encoding handling tests
  - lp:~mvo/aptdaemon/relax-lintian-checks merged
  - improve terminal handling, LP: #741260, #693290, #741260,  
    #738056,  #742780, #743818, #744444, #746727, #747539, #753700,
    #753762, #753927, #754134, #754174, #754205, #754206, #754220
  - fix refactoring lefovers (LP: #752220)
  - don't segfault if we cannot read the status of the process holding 
    a lock (LP: #745517)
* debian/patches/01_relax_lintian_checks.patch:
  - removed, taken upstream
* debian/patches/02_fix_unicode_in_convert_struct.patch:
  - removed, taken usptream
* debian/patches/04_import_logging.patch:
  - removed, fixed usptream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- coding: utf-8 -*-
3
 
# Copyright (C) 2011 Michael Vogt <mvo@ubuntu.com>
4
 
#
5
 
# Licensed under the GNU General Public License Version 2
6
 
#
7
 
# This program is free software; you can redistribute it and/or modify
8
 
# it under the terms of the GNU General Public License as published by
9
 
# the Free Software Foundation; either version 2 of the License, or
10
 
# at your option) any later version.
11
 
#
12
 
# This program is distributed in the hope that it will be useful,
13
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
# GNU General Public License for more details.
16
 
#
17
 
# You should have received a copy of the GNU General Public License
18
 
# along with this program; if not, write to the Free Software
19
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
 
# Licensed under the GNU General Public License Version 2
21
 
 
22
 
"""Regression test for a unicode decoding error in the status_details
23
 
attribute of the worker, see LP #724735.
24
 
 
25
 
It seems that we don't decode the status message received from the
26
 
status fd of apt.
27
 
"""
28
 
 
29
 
__author__  = "Michael Vogt <mvo@glatzor.de>"
30
 
 
31
 
import os
32
 
import unittest2
33
 
 
34
 
import dbus
35
 
 
36
 
from aptdaemon.core import Transaction
37
 
from aptdaemon.test import AptDaemonTestCase
38
 
 
39
 
 
40
 
class TestWorkaround(AptDaemonTestCase):
41
 
 
42
 
    """Test the workaround."""
43
 
 
44
 
    def setUp(self):
45
 
        self.start_dbus_daemon()
46
 
        self.dbus = dbus.bus.BusConnection(self.dbus_address)
47
 
 
48
 
    def test(self):
49
 
        trans = Transaction("role-test", None, os.getuid(),
50
 
                            "org.debian.apt.test", bus=self.dbus)
51
 
        # ensure we don't crash regardless if str or unicode is passed here
52
 
        trans._set_status_details("äää")
53
 
        trans._set_status_details(u"äää")
54
 
 
55
 
 
56
 
if __name__ == "__main__":
57
 
    unittest2.main()
58
 
 
59
 
# vim: ts=4 et sts=4