Skip to content

Commit

Permalink
add some more tests to make sure everything is working as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
saponifi3d committed Dec 14, 2024
1 parent e2cfa38 commit 5c51398
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/sentry/workflow_engine/models/test_data_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from unittest import mock

import pytest

from sentry.workflow_engine.registry import data_source_type_registry
from tests.sentry.workflow_engine.test_base import BaseWorkflowTest


class DataSourceTest(BaseWorkflowTest):
def test_inavlid_data_source_type(self):
with pytest.raises(ValueError):
self.create_data_source(type="invalid_type")

def test_data_source_valid_type(self):
test_type = "test"
type_mock = mock.Mock()

data_source_type_registry.register(test_type)(type_mock)
assert data_source_type_registry.get(test_type) == type_mock

data_source = self.create_data_source(type=test_type)

assert data_source is not None
6 changes: 6 additions & 0 deletions tests/sentry/workflow_engine/processors/test_data_sources.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
from unittest import mock

from sentry.snuba.models import SnubaQuery
from sentry.testutils.cases import TestCase
from sentry.workflow_engine.models import DataPacket
from sentry.workflow_engine.processors import process_data_sources
from sentry.workflow_engine.registry import data_source_type_registry

# Setup a mock data source for the tests
data_source_type_registry.register("test")(mock.Mock)


class TestProcessDataSources(TestCase):
Expand Down

0 comments on commit 5c51398

Please sign in to comment.