~apachelogger/software-properties/python-apt-is-like

« back to all changes in this revision

Viewing changes to tests/test_lp.py

  • Committer: Dimitri John Ledkov
  • Date: 2016-09-21 11:48:24 UTC
  • Revision ID: xnox@ubuntu.com-20160921114824-vsme41rnep1vcerk
Fix incorrect owner_name used by launchpad PPA info api. Fix online
testsuite in python3 and python2. Skip bad SSL test in python2, as
pycurl no longer raises an exception. Drop python3-pycurl dependency,
not used in python3 code path nor tests any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import sys
6
6
sys.path.insert(0, "..")
7
7
 
8
 
import pycurl
9
 
 
10
8
from mock import patch
11
9
 
12
10
import softwareproperties.ppa
13
11
from  softwareproperties.ppa import (
14
12
    AddPPASigningKeyThread,
15
13
    mangle_ppa_shortcut,
16
 
    PPAException,
17
14
    verify_keyid_is_v4,
18
15
    )
19
16
 
34
31
    @unittest.skipUnless(
35
32
        "TEST_ONLINE" in os.environ,
36
33
        "skipping online tests unless TEST_ONLINE environment variable is set")
 
34
    @unittest.skipUnless(
 
35
        sys.version_info[0] > 2,
 
36
        "pycurl doesn't raise SSL exceptions anymore it seems")
37
37
    def test_ppa_info_from_lp(self):
38
38
        # use correct data
39
39
        info = softwareproperties.ppa.get_ppa_info_from_lp("mvo", "ppa")
41
41
        self.assertEqual(info["name"], "ppa")
42
42
        # use empty CERT file
43
43
        softwareproperties.ppa.LAUNCHPAD_PPA_CERT = "/dev/null"
44
 
        with self.assertRaises(PPAException) as cm:
 
44
        with self.assertRaises(Exception):
45
45
            softwareproperties.ppa.get_ppa_info_from_lp("mvo", "ppa")
46
 
        self.assertEqual(
47
 
            cm.exception.original_error.args[0], pycurl.E_SSL_CACERT)
48
46
 
49
47
    def test_mangle_ppa_shortcut(self):
50
48
        self.assertEqual("~mvo/ubuntu/ppa", mangle_ppa_shortcut("ppa:mvo"))