Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/usr/bin/env python |
michael@0 | 2 | |
michael@0 | 3 | import os |
michael@0 | 4 | import unittest |
michael@0 | 5 | from manifestparser import TestManifest |
michael@0 | 6 | |
michael@0 | 7 | here = os.path.dirname(os.path.abspath(__file__)) |
michael@0 | 8 | |
michael@0 | 9 | class TestTestManifest(unittest.TestCase): |
michael@0 | 10 | """Test the Test Manifest""" |
michael@0 | 11 | |
michael@0 | 12 | def test_testmanifest(self): |
michael@0 | 13 | # Test filtering based on platform: |
michael@0 | 14 | filter_example = os.path.join(here, 'filter-example.ini') |
michael@0 | 15 | manifest = TestManifest(manifests=(filter_example,)) |
michael@0 | 16 | self.assertEqual([i['name'] for i in manifest.active_tests(os='win', disabled=False, exists=False)], |
michael@0 | 17 | ['windowstest', 'fleem']) |
michael@0 | 18 | self.assertEqual([i['name'] for i in manifest.active_tests(os='linux', disabled=False, exists=False)], |
michael@0 | 19 | ['fleem', 'linuxtest']) |
michael@0 | 20 | |
michael@0 | 21 | # Look for existing tests. There is only one: |
michael@0 | 22 | self.assertEqual([i['name'] for i in manifest.active_tests()], |
michael@0 | 23 | ['fleem']) |
michael@0 | 24 | |
michael@0 | 25 | # You should be able to expect failures: |
michael@0 | 26 | last_test = manifest.active_tests(exists=False, toolkit='gtk2')[-1] |
michael@0 | 27 | self.assertEqual(last_test['name'], 'linuxtest') |
michael@0 | 28 | self.assertEqual(last_test['expected'], 'pass') |
michael@0 | 29 | last_test = manifest.active_tests(exists=False, toolkit='cocoa')[-1] |
michael@0 | 30 | self.assertEqual(last_test['expected'], 'fail') |
michael@0 | 31 | |
michael@0 | 32 | def test_comments(self): |
michael@0 | 33 | """ |
michael@0 | 34 | ensure comments work, see |
michael@0 | 35 | https://bugzilla.mozilla.org/show_bug.cgi?id=813674 |
michael@0 | 36 | """ |
michael@0 | 37 | comment_example = os.path.join(here, 'comment-example.ini') |
michael@0 | 38 | manifest = TestManifest(manifests=(comment_example,)) |
michael@0 | 39 | self.assertEqual(len(manifest.tests), 8) |
michael@0 | 40 | names = [i['name'] for i in manifest.tests] |
michael@0 | 41 | self.assertFalse('test_0202_app_launch_apply_update_dirlocked.js' in names) |
michael@0 | 42 | |
michael@0 | 43 | |
michael@0 | 44 | if __name__ == '__main__': |
michael@0 | 45 | unittest.main() |