import json

from airflow.models.connection import Connection

from twitch_airflow_components.operators.postgres import PostgresOperator


def test_init():
    connection = Connection(
        host="redshift.com",
        login="redshift_user",
        schema="db_name",
        extra=json.dumps({"iam": True, "aws_conn_id": None, "redshift": True}),
    )
    PostgresOperator(
        sql="SELECT * FROM test_table", connection=connection, task_id="test"
    )
