From a85a953e8ef43dfcf003f1354cc5fea05ee37e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Fri, 24 Feb 2017 12:08:35 +0100 Subject: [PATCH] Adapt get_last tests to new output --- test/mod_admin_extra_test.exs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/mod_admin_extra_test.exs b/test/mod_admin_extra_test.exs index f5d0b33f3..eefe2e9bd 100644 --- a/test/mod_admin_extra_test.exs +++ b/test/mod_admin_extra_test.exs @@ -198,29 +198,29 @@ defmodule EjabberdModAdminExtraTest do test "get_last works" do - assert 'Never' == + assert {_, 'NOT FOUND'} = :ejabberd_commands.execute_command(:get_last, [@user, @domain]) EjabberdSmMock.connect_resource @user, @domain, @resource<>"1" EjabberdSmMock.connect_resource @user, @domain, @resource<>"2" - assert 'Online' == + assert {_, 'ONLINE'} = :ejabberd_commands.execute_command(:get_last, [@user, @domain]) EjabberdSmMock.disconnect_resource @user, @domain, @resource<>"1" - assert 'Online' == + assert {_, 'ONLINE'} = :ejabberd_commands.execute_command(:get_last, [@user, @domain]) now = {megasecs, secs, _microsecs} = :os.timestamp timestamp = megasecs * 1000000 + secs EjabberdSmMock.disconnect_resource(@user, @domain, @resource<>"2", timestamp) - {{year, month, day}, {hour, minute, second}} = :calendar.now_to_local_time now - result = List.flatten(:io_lib.format( - "~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w ", + {{year, month, day}, {hour, minute, second}} = :calendar.now_to_universal_time now + result = IO.iodata_to_binary(:io_lib.format( + "~w-~.2.0w-~.2.0wT~.2.0w:~.2.0w:~.2.0wZ", [year, month, day, hour, minute, second])) - assert result == + assert {result, ""} == :ejabberd_commands.execute_command(:get_last, [@user, @domain]) assert :meck.validate :mod_last