Skip to content
Snippets Groups Projects
Commit 53c9899d authored by David Trattnig's avatar David Trattnig
Browse files

test: test case to clear queue #116

parent aa928a4b
No related branches found
No related tags found
No related merge requests found
#!/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"
def clear_queue(s) =
q = s.queue()
s.set_queue([])
list.iter(request.destroy, q)
end
# 1.) Create queue and add requests
q = request.queue(id="q")
r = request.create("assets/audio.mp3")
q.push(r)
q.push(r)
q.push(r)
# 2.) Check queue length
len = list.length(q.queue())
print("QUEUE LENGTH: #{len}")
assertEquals(3, len)
# 3.) Clear queue
clear_queue(q)
# 4.) Check queue length
len = list.length(q.queue())
print("QUEUE LENGTH: #{len}")
assertEquals(0, len)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment