def test_can_assert_mock_call_count(): prop1 = PyMock.new_mock(name="test_class.prop1", return_values=[1]) prop1() prop1() assert_that(prop1).call_count(2) assert_exception(lambda: assert_that(prop1).call_count(1), "Expect call count 1. Got 2")
def mock_path_rel_to_cwd(self): mock = PyMock.new_mock( name='file_system.path_rel_to_cwd', call_fake=lambda x: '/rel_to_cwd/' + x['args'][0]) self.file_system.path_rel_to_cwd = mock
def mock_path_rel_to_app_dir(self): mock = PyMock.new_mock(name='file_system.path_rel_to_app_dir', call_fake=lambda x: MockFileSystem.krogon_dir() + '/' + x['args'][0]) self.file_system.path_rel_to_app_dir = mock
def mock_write(self): mock = PyMock.new_mock(name='file_system.write', return_values=['']) self.file_system.write = mock
def test_can_setup_and_create_mock_in_one_step(): prop1 = PyMock.new_mock(name="test_class.prop1", return_values=[1]) assert prop1() == 1