| Total Complexity | 4 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| 1 | # -*- coding: utf-8 -*- |
||
| 21 | class ProtectedTests(unittest.TestCase): |
||
| 22 | |||
| 23 | def setUp(self): |
||
| 24 | pass |
||
| 25 | |||
| 26 | def test_protected_resource_event(self): |
||
| 27 | event = ProtectedResourceEvent('urn:test') |
||
| 28 | self.assertEqual('urn:test', event.uri) |
||
| 29 | |||
| 30 | def test_protected_resource_exception(self): |
||
| 31 | referenced_in = ['urn:someobject', 'http://test.test.org/object/2'] |
||
| 32 | error = ProtectedResourceException('test_msg', referenced_in) |
||
| 33 | self.assertIsNotNone(error) |
||
| 34 | self.assertEqual("'test_msg'", str(error)) |
||
| 35 | |||
| 36 | def test_protected_event(self): |
||
| 37 | dummy = DummyParent() |
||
| 38 | notify_mock = Mock() |
||
| 39 | dummy.request.registry.notify = notify_mock |
||
| 40 | dummy.protected_dummy() |
||
| 41 | notify_call = notify_mock.mock_calls[0] |
||
| 42 | self.assertEqual('http://localhost/conceptschemes/GEOGRAPHY/c/9', notify_call[1][0].uri) |