| 1 | from pbcommand.testkit.base_utils import pb_requirements |
| 2 | |
| 3 | |
| 4 | class TestBaseUtils: |
| 5 | |
| 6 | def test_pb_requirements_decorator(self): |
| 7 | """ |
| 8 | Test that the pb_requirements decorator monkey-patches test methods |
| 9 | correctly. |
| 10 | """ |
| 11 | class MyTestClass: |
| 12 | @pb_requirements("SL-1") |
| 13 | def test_1(self): |
| 14 | assert True |
| 15 | |
| 16 | @pb_requirements("SL-2") |
| 17 | def test_2(self): |
| 18 | self.fail("Fail!") |
| 19 | |
| 20 | methods = [ |
| 21 | MyTestClass.test_1, |
| 22 | MyTestClass.test_2, |
| 23 | ] |
| 24 | requirements = [m.__pb_requirements__ for m in methods] |
| 25 | assert requirements == [['SL-1'], ['SL-2']] |