2016-10-01 20:57:09 +02:00
|
|
|
#! /usr/bin/python3
|
2015-04-01 10:55:33 +02:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Copyright (C) 2015 Christian Boltz <apparmor@cboltz.de>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
|
|
|
import unittest
|
2019-02-10 23:24:29 +01:00
|
|
|
from common_test import AATest, setup_all_loops # , setup_aa
|
|
|
|
# import apparmor.aa as aa # see the setup_aa() call for details
|
2015-04-01 10:55:33 +02:00
|
|
|
|
|
|
|
class TestFoo(AATest):
|
|
|
|
tests = [
|
|
|
|
(0, 0 ),
|
|
|
|
(42, 42),
|
|
|
|
]
|
|
|
|
|
|
|
|
def _run_test(self, params, expected):
|
|
|
|
self.assertEqual(params, expected)
|
|
|
|
|
|
|
|
class TestBar(AATest):
|
|
|
|
tests = [
|
|
|
|
('a', 'foo'),
|
|
|
|
('b', 'bar'),
|
|
|
|
('c', 'baz'),
|
|
|
|
]
|
|
|
|
|
|
|
|
def _run_test(self, params, expected):
|
|
|
|
self.assertNotEqual(params, expected)
|
|
|
|
|
|
|
|
def testAdditionalBarTest(self):
|
|
|
|
self.assertEqual(1, 1)
|
|
|
|
|
|
|
|
class TestBaz(AATest):
|
2015-04-28 23:37:49 +02:00
|
|
|
def AASetup(self):
|
|
|
|
# called by setUp() - use AASetup() to avoid the need for using super(...)
|
|
|
|
pass
|
|
|
|
|
2015-05-29 12:55:38 +02:00
|
|
|
def AATeardown(self):
|
|
|
|
# called by tearDown() - use AATeardown() to avoid the need for using super(...)
|
|
|
|
pass
|
|
|
|
|
2015-04-01 10:55:33 +02:00
|
|
|
def test_Baz_only_one_test(self):
|
|
|
|
self.assertEqual("baz", "baz")
|
|
|
|
|
2019-02-10 23:24:29 +01:00
|
|
|
# if you import apparmor.aa and call init_aa() in your tests, uncomment this
|
|
|
|
# setup_aa(aa)
|
2015-04-22 22:01:34 +02:00
|
|
|
setup_all_loops(__name__)
|
2015-04-01 10:55:33 +02:00
|
|
|
if __name__ == '__main__':
|
2018-04-08 20:18:30 +02:00
|
|
|
unittest.main(verbosity=1)
|