2021-01-31 22:40:30 -08:00
|
|
|
import unittest
|
2021-02-11 22:48:08 -08:00
|
|
|
from unittest.mock import patch
|
2021-01-31 22:40:30 -08:00
|
|
|
|
|
|
|
from gometa.ingestion.run.pipeline import Pipeline
|
|
|
|
|
|
|
|
|
|
|
|
class PipelineTest(unittest.TestCase):
|
2021-02-05 21:03:04 -08:00
|
|
|
@patch("gometa.ingestion.source.kafka.KafkaSource.get_workunits")
|
|
|
|
@patch("gometa.ingestion.sink.console.ConsoleSink.close")
|
2021-02-10 14:53:55 -08:00
|
|
|
def test_configure(self, mock_sink, mock_source):
|
2021-02-11 19:12:43 -08:00
|
|
|
pipeline = Pipeline.create(
|
2021-02-11 22:48:08 -08:00
|
|
|
{
|
2021-02-12 12:05:41 -08:00
|
|
|
"source": {"type": "kafka", "config": {"bootstrap": "localhost:9092"}},
|
2021-02-11 22:48:08 -08:00
|
|
|
"sink": {"type": "console"},
|
|
|
|
}
|
2021-02-05 21:03:04 -08:00
|
|
|
)
|
|
|
|
pipeline.run()
|
2021-01-31 22:40:30 -08:00
|
|
|
mock_source.assert_called_once()
|
|
|
|
mock_sink.assert_called_once()
|