Fix calendar event listing and link output
Debian Trixie package bundle / packages (push) Successful in 22m31s
Debian Trixie package bundle / packages (push) Successful in 22m31s
This commit is contained in:
@@ -975,6 +975,7 @@ StoreObjectIterLinks(StoreClient *client, StoreObject *document, BOOL reverse)
|
||||
query = "l to ?1";
|
||||
|
||||
QueryBuilderStart(&builder);
|
||||
QueryBuilderSetOutputMode(&builder, MODE_LIST);
|
||||
|
||||
QueryBuilderSetQuerySafe(&builder, query);
|
||||
|
||||
|
||||
@@ -109,11 +109,13 @@ class CalendarEventsCommand(Command):
|
||||
print("Could not find calendar named '%s'" % args[0])
|
||||
return
|
||||
|
||||
events = list(store.Events(cal.uid, ["nmap.document",
|
||||
"nmap.event.calendars"]))
|
||||
events = list(store.Events(cal.uid))
|
||||
|
||||
for event in events:
|
||||
jsob = simplejson.loads(event.props["nmap.document"].strip())
|
||||
payload = store.Read(event.uid)
|
||||
if isinstance(payload, bytes):
|
||||
payload = payload.decode("utf-8")
|
||||
jsob = simplejson.loads(payload.strip())
|
||||
comp = jsob["components"][0]
|
||||
|
||||
summary = _json_component_value(comp, "summary")
|
||||
|
||||
@@ -129,6 +129,30 @@ class Python3RuntimeTests(unittest.TestCase):
|
||||
store.Read.assert_called_once_with(contact.uid)
|
||||
self.assertIn("\u00c4nne Example", output.call_args.args[0])
|
||||
|
||||
def test_calendar_listing_reads_event_document_bodies(self):
|
||||
calendar = SimpleNamespace(uid="calendar-guid")
|
||||
event = SimpleNamespace(uid="event-guid")
|
||||
store = mock.Mock()
|
||||
store.List.return_value = [
|
||||
SimpleNamespace(filename="/calendars/Holidays",
|
||||
uid=calendar.uid)]
|
||||
store.Events.return_value = [event]
|
||||
store.Read.return_value = (
|
||||
b'{"components":[{"summary":{"value":"Holiday"},'
|
||||
b'"dtstart":{"value":"20260724"},'
|
||||
b'"dtend":{"value":"20260725"}}]}')
|
||||
|
||||
from bongo.storetool.CalendarCommands import CalendarEventsCommand
|
||||
command = CalendarEventsCommand()
|
||||
with mock.patch(
|
||||
"bongo.storetool.CalendarCommands.connect_store",
|
||||
return_value=store), \
|
||||
mock.patch("builtins.print"):
|
||||
command.Run(SimpleNamespace(), ["Holidays"])
|
||||
|
||||
store.Events.assert_called_once_with(calendar.uid)
|
||||
store.Read.assert_called_once_with(event.uid)
|
||||
|
||||
def test_console_table_and_unicode_template_are_text(self):
|
||||
self.assertIsInstance(wrap("Grüße 世界", width=8), str)
|
||||
self.assertEqual(table.format_table(["Name"], [["Müller"]]),
|
||||
|
||||
Reference in New Issue
Block a user