mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-29 14:59:55 +00:00
27 lines
725 B
Python
27 lines
725 B
Python
from unittest.mock import MagicMock
|
|
|
|
from django.db.models import Q
|
|
|
|
import pytest
|
|
|
|
from baserow.contrib.automation.object_scopes import AutomationObjectScopeType
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_raises_if_scope_type_invalid():
|
|
mock_scope = MagicMock()
|
|
mock_scope.type = "foo"
|
|
|
|
with pytest.raises(TypeError) as exc_info:
|
|
AutomationObjectScopeType().get_filter_for_scope_type(mock_scope, [])
|
|
|
|
assert str(exc_info.value) == "The given type is not handled."
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_get_filter_for_scope_type():
|
|
mock_scope = MagicMock()
|
|
mock_scope.type = "automation"
|
|
|
|
result = AutomationObjectScopeType().get_filter_for_scope_type(mock_scope, [])
|
|
assert result == Q(id__in=[])
|