mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
Internal Server Error at API call for paged dates of an event #365
This commit is contained in:
parent
b6e2182a61
commit
f652620617
@ -146,7 +146,7 @@ class EventDatesResource(BaseResource):
|
||||
@use_kwargs(EventDateListRequestSchema, location=("query"))
|
||||
@marshal_with(EventDateListResponseSchema)
|
||||
@require_oauth(optional=True)
|
||||
def get(self, id):
|
||||
def get(self, id, **kwargs):
|
||||
event = Event.query.options(
|
||||
load_only(Event.id, Event.public_status)
|
||||
).get_or_404(id)
|
||||
|
||||
@ -460,13 +460,15 @@ class LdJsonImporter:
|
||||
if isinstance(value, dict):
|
||||
result = dict()
|
||||
for k, v in value.items():
|
||||
result[k] = self._strip_ld_json(v)
|
||||
if v:
|
||||
result[k] = self._strip_ld_json(v)
|
||||
return result
|
||||
|
||||
if isinstance(value, list):
|
||||
result = list()
|
||||
for elem in value:
|
||||
result.append(self._strip_ld_json(elem))
|
||||
if elem:
|
||||
result.append(self._strip_ld_json(elem))
|
||||
return result
|
||||
|
||||
return value
|
||||
|
||||
@ -128,6 +128,14 @@ def test_dates(client, seeder, utils):
|
||||
response = utils.get(url)
|
||||
utils.assert_response_unauthorized(response)
|
||||
|
||||
event_id = seeder.create_event(
|
||||
admin_unit_id, recurrence_rule="RRULE:FREQ=DAILY;COUNT=51"
|
||||
)
|
||||
url = utils.get_url("api_v1_event_dates", id=event_id)
|
||||
utils.get_ok(url)
|
||||
url = utils.get_url("api_v1_event_dates", id=event_id, page=2)
|
||||
utils.get_ok(url)
|
||||
|
||||
|
||||
def test_dates_myDraft(client, seeder, utils):
|
||||
user_id, admin_unit_id = seeder.setup_api_access()
|
||||
|
||||
@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
|
||||
# Load more urls:
|
||||
# curl -o tests/services/importer/test_event_importer/<filename>.html <URL>
|
||||
# curl -o tests/services/importer/data/<filename>.html <URL>
|
||||
def test_import(client, seeder, utils, app, shared_datadir, requests_mock):
|
||||
_, admin_unit_id = seeder.setup_base()
|
||||
seeder.upsert_event_place(admin_unit_id, "MINER'S ROCK")
|
||||
|
||||
@ -42,6 +42,14 @@ class TestLdJsonImporter(SubTests):
|
||||
event = self._load_event_from_ld_json(manipulate)
|
||||
assert event is not None
|
||||
|
||||
def _test_null_organizer_but_author(self):
|
||||
def manipulate(ld_json):
|
||||
ld_json["author"] = ld_json["organizer"]
|
||||
ld_json["organizer"] = [None]
|
||||
|
||||
event = self._load_event_from_ld_json(manipulate)
|
||||
assert event is not None
|
||||
|
||||
def _test_no_organizer(self):
|
||||
import pytest
|
||||
|
||||
@ -90,7 +98,7 @@ class TestLdJsonImporter(SubTests):
|
||||
manipulate_json(ld_json)
|
||||
|
||||
importer = LdJsonImporter("", "")
|
||||
importer.ld_json = ld_json
|
||||
importer.ld_json = importer._strip_ld_json(ld_json)
|
||||
event = importer.load_event_from_ld_json()
|
||||
|
||||
return event
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user