1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-22 07:42:36 +00:00
bramw_baserow/backend/tests/baserow/contrib/builder/test_builder_handler.py
2024-07-03 12:05:50 +00:00

34 lines
1017 B
Python

import pytest
from baserow.contrib.builder.handler import BuilderHandler
from baserow.core.exceptions import ApplicationDoesNotExist
@pytest.mark.django_db
def test_get_builder(data_fixture):
builder = data_fixture.create_builder_application()
assert BuilderHandler().get_builder(builder.id).id == builder.id
@pytest.mark.django_db
def test_get_builder_does_not_exist(data_fixture):
with pytest.raises(ApplicationDoesNotExist):
BuilderHandler().get_builder(9999)
@pytest.mark.django_db(transaction=True)
def test_get_builder_select_related_theme_config(
data_fixture, django_assert_num_queries
):
builder = data_fixture.create_builder_application()
builder.colorthemeconfigblock
builder.typographythemeconfigblock
builder.buttonthemeconfigblock
builder = BuilderHandler().get_builder(builder.id)
with django_assert_num_queries(0):
builder.colorthemeconfigblock.id
builder.typographythemeconfigblock.id
builder.buttonthemeconfigblock.id