]> granicus.if.org Git - ejabberd/commitdiff
Adapt get_last tests to new output
authorPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 24 Feb 2017 11:08:35 +0000 (12:08 +0100)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 24 Feb 2017 11:08:57 +0000 (12:08 +0100)
test/mod_admin_extra_test.exs

index f5d0b33f398f808144952287a7fb816edc12893a..eefe2e9bdcbf662ed6b9d43a00cc47109b0b404a 100644 (file)
@@ -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