From 1315f3d057c574100e5007b9e87b4c2b12a58044 Mon Sep 17 00:00:00 2001 From: David Trattnig <david@subsquare.at> Date: Tue, 12 Jul 2022 14:45:48 +0200 Subject: [PATCH] Test: Metadata build --- tests/test_metadata_build.liq | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 tests/test_metadata_build.liq diff --git a/tests/test_metadata_build.liq b/tests/test_metadata_build.liq new file mode 100755 index 0000000..e481242 --- /dev/null +++ b/tests/test_metadata_build.liq @@ -0,0 +1,42 @@ +#!/usr/bin/env liquidsoap +# +# Aura Engine (https://gitlab.servus.at/aura/engine) +# +# Copyright (C) 2017-now() - The Aura Engine Team. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +%include "base_config.liq" +%include "../src/functions.liq" + + +json_string = "{ \ + \"show_name\": \"Laser Music 2000\", \ + \"show_id\": -1, \ + \"timeslot_id\": -1, \ + \"playlist_id\": -1, \ + \"playlist_item\": \"\", \ + \"track_type\": 0, \ + \"track_start\": \"2022/02/22 22:02:22\", \ + \"track_duration\": 303, \ + \"track_title\": \"FooBar 2000\", \ + \"track_album\": \"\", \ + \"track_artist\": \"\" \ + }" + +metadata = build_metadata(json_string) +title = metadata["track_title"] +print("Track title: #{title}") +assertEquals(title, "FooBar 2000") -- GitLab