(self)
| 2009 | |
| 2010 | |
| 2011 | def test_manager_mock(self): |
| 2012 | class Foo(object): |
| 2013 | one = 'one' |
| 2014 | two = 'two' |
| 2015 | manager = Mock() |
| 2016 | p1 = patch.object(Foo, 'one') |
| 2017 | p2 = patch.object(Foo, 'two') |
| 2018 | |
| 2019 | mock_one = p1.start() |
| 2020 | self.addCleanup(p1.stop) |
| 2021 | mock_two = p2.start() |
| 2022 | self.addCleanup(p2.stop) |
| 2023 | |
| 2024 | manager.attach_mock(mock_one, 'one') |
| 2025 | manager.attach_mock(mock_two, 'two') |
| 2026 | |
| 2027 | Foo.two() |
| 2028 | Foo.one() |
| 2029 | |
| 2030 | self.assertEqual(manager.mock_calls, [call.two(), call.one()]) |
| 2031 | |
| 2032 | |
| 2033 | def test_magic_methods_mock_calls(self): |
nothing calls this directly
no test coverage detected