def test_ok_wo_offset(self, model_manager: BaseModelManager, mocker: MockFixture): fake_sql = mocker.patch.object(model_manager, 'sql') mocked_get_sql = mocker.patch.object(model_manager, 'get_sql') model_manager.offset() mocked_get_sql.assert_not_called() compared_sql = model_manager.sql assert compared_sql == fake_sql
def test_ok_with_offset(self, model_manager: BaseModelManager, mocker: MockFixture): fake_offset = 10 mocked_get_sql = mocker.patch.object(model_manager, 'get_sql') model_manager.offset(fake_offset) mocked_get_sql.return_value.offset.assert_called_once_with(fake_offset) compared_sql = model_manager.sql expected_sql = mocked_get_sql.return_value.offset.return_value assert compared_sql == expected_sql