mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Replace SCSS compilation with CSS variables (#4191)
* Replace SCSS compilation with CSS variables * Update tests * Update src/pretix/presale/style.py Co-authored-by: Mira <weller@rami.io> * Update src/pretix/presale/context.py Co-authored-by: Mira <weller@rami.io> * Update src/pretix/presale/views/widget.py Co-authored-by: Mira <weller@rami.io> * Update src/pretix/presale/context.py Co-authored-by: Mira <weller@rami.io> * Update src/pretix/static/pretixbase/scss/_variables.scss Co-authored-by: Richard Schreiber <schreiber@rami.io> * Last minor changes * Rename file --------- Co-authored-by: Mira <weller@rami.io> Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -23,8 +23,6 @@ import pytest
|
||||
from django.core.files.base import ContentFile
|
||||
from tests.const import SAMPLE_PNG
|
||||
|
||||
from pretix.testutils.mock import mocker_context
|
||||
|
||||
TEST_ORGANIZER_RES = {
|
||||
"name": "Dummy",
|
||||
"slug": "dummy",
|
||||
@@ -69,62 +67,57 @@ def test_get_settings(token_client, organizer):
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_patch_settings(token_client, organizer):
|
||||
with mocker_context() as mocker:
|
||||
mocked = mocker.patch('pretix.presale.style.regenerate_organizer_css.apply_async')
|
||||
organizer.settings.event_list_type = 'week'
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'event_list_type': 'list'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.data['event_list_type'] == "list"
|
||||
organizer.settings.flush()
|
||||
assert organizer.settings.event_list_type == 'list'
|
||||
|
||||
organizer.settings.event_list_type = 'week'
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'event_list_type': 'list'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.data['event_list_type'] == "list"
|
||||
organizer.settings.flush()
|
||||
assert organizer.settings.event_list_type == 'list'
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'event_list_type': None,
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.data['event_list_type'] == "list"
|
||||
organizer.settings.flush()
|
||||
assert organizer.settings.event_list_type == 'list'
|
||||
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'event_list_type': None,
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.data['event_list_type'] == "list"
|
||||
organizer.settings.flush()
|
||||
assert organizer.settings.event_list_type == 'list'
|
||||
mocked.assert_not_called()
|
||||
resp = token_client.put(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'event_list_type': 'put-not-allowed'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 405
|
||||
|
||||
resp = token_client.put(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'event_list_type': 'put-not-allowed'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 405
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'primary_color': 'invalid-color'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'primary_color': 'invalid-color'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'primary_color': '#ff0000'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
mocked.assert_any_call(args=(organizer.pk,))
|
||||
resp = token_client.patch(
|
||||
'/api/v1/organizers/{}/settings/'.format(organizer.slug),
|
||||
{
|
||||
'primary_color': '#ff0000'
|
||||
},
|
||||
format='json'
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
Reference in New Issue
Block a user