1
0
mirror of synced 2025-12-25 02:09:19 -05:00
Files
airbyte/airbyte-integrations/connectors/source-smartsheets/unit_tests/conftest.py
Cole Snodgrass 2e099acc52 update headers from 2022 -> 2023 (#22594)
* It's 2023!

* 2022 -> 2023

---------

Co-authored-by: evantahler <evan@airbyte.io>
2023-02-08 13:01:16 -08:00

35 lines
817 B
Python

#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import json
from pathlib import Path
from unittest.mock import Mock
import pytest
from smartsheet.models import Sheet
HERE = Path(__file__).parent.absolute()
@pytest.fixture
def response_mock():
with open(HERE / "response.json") as json_file:
return json.loads(json_file.read())
@pytest.fixture
def config():
return {"spreadsheet_id": "id", "access_token": "token"}
@pytest.fixture
def get_sheet_mocker(mocker, response_mock):
def _mocker(api_wrapper, data=None):
sheet_obj = Sheet(props=response_mock, base_obj=api_wrapper)
get_sheet_mock = Mock(return_value=sheet_obj)
mocker.patch.object(api_wrapper, "_get_sheet", data or get_sheet_mock)
return get_sheet_mock, sheet_obj
return _mocker