File: test_origin.py

package info (click to toggle)
software-center 5.1.2debian3.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,708 kB
  • sloc: python: 28,999; xml: 379; sh: 127; makefile: 28
file content (33 lines) | stat: -rw-r--r-- 976 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python

import sys
import unittest
sys.path.insert(0,"../")

import apt

class TestOrigins(unittest.TestCase):
    """ tests the origin code """

    def test_origin(self):
        # get a cache
        cache = apt.Cache(rootdir="./data/aptroot")
        cache.update()
        cache.open()
        # PPA origin
        origins = cache["firefox-trunk"].candidate.origins
        print origins
        self.assertEqual(origins[0].site, "ppa.launchpad.net")
        self.assertEqual(origins[0].origin, "LP-PPA-ubuntu-mozilla-daily")
        # archive origin
        origins = cache["apt"].candidate.origins
        self.assertEqual(origins[0].site, "archive.ubuntu.com")
        self.assertEqual(origins[0].origin, "Ubuntu")
        self.assertEqual(origins[1].site, "de.archive.ubuntu.com")
        self.assertEqual(origins[1].origin, "Ubuntu")
        

if __name__ == "__main__":
    import logging
    logging.basicConfig(level=logging.DEBUG)
    unittest.main()