1
0
mirror of synced 2026-01-10 00:03:08 -05:00
Files
airbyte/airbyte-integrations/connectors/source-file-secure/unit_tests/unit_test.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
1.1 KiB
Python

#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import pytest
from airbyte_cdk import AirbyteLogger
from source_file_secure import SourceFileSecure
from source_file_secure.source import LOCAL_STORAGE_NAME
local_storage_config = {
"dataset_name": "test",
"format": "csv",
"reader_options": '{"sep": ",", "nrows": 20}',
"url": "file:///tmp/fake_file.csv",
"provider": {
"storage": LOCAL_STORAGE_NAME.upper(),
},
}
def test_local_storage_spec():
"""Checks spec properties"""
source = SourceFileSecure()
spec = source.spec(logger=AirbyteLogger())
for provider in spec.connectionSpecification["properties"]["provider"]["oneOf"]:
assert provider["properties"]["storage"]["const"] != LOCAL_STORAGE_NAME, "This connector shouldn't work with local files."
def test_local_storage_check():
"""Checks working with a local options"""
source = SourceFileSecure()
with pytest.raises(RuntimeError) as exc:
source.check(logger=AirbyteLogger(), config=local_storage_config)
assert "not supported" in str(exc.value)