diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-01-30 15:25:37 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-01-30 15:25:37 +0100 |
| commit | 2021c1b4973c3201b1e4580d00b7351c23a831c4 (patch) | |
| tree | ad93be852c4b8eec0b5d4e8fafda5a0bde3f9352 /tests/test_policy.py | |
| parent | 6c8269fc130c66d4a450a004af4e120e074808ce (diff) | |
| download | python-apt-2021c1b4973c3201b1e4580d00b7351c23a831c4.tar.gz | |
RED: policy should support verfile
Diffstat (limited to 'tests/test_policy.py')
| -rw-r--r-- | tests/test_policy.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_policy.py b/tests/test_policy.py new file mode 100644 index 00000000..2d261f5f --- /dev/null +++ b/tests/test_policy.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# +# Copyright (C) 2012 Michael Vogt <mvo@ubuntu.com> +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +import apt +import unittest + +class TestAptPolicy(unittest.TestCase): + + def test_apt_policy(self): + # get a policy + cache = apt.Cache() + policy = cache._depcache.policy + self.assertNotEqual(policy, None) + # basic tests + pkg = cache["apt"] + self.assertEqual(policy.get_priority(pkg._pkg), 0) + # get verfile + ver = pkg.candidate._cand + verfile_list = ver.file_list + for verfile in verfile_list: + print verfile + self.assertEqual(policy.get_priority(verfile), 500) + + +if __name__ == "__main__": + unittest.main() |
