mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Adapt get_last tests to new output
This commit is contained in:
parent
c950fc05f0
commit
a85a953e8e
@ -198,29 +198,29 @@ defmodule EjabberdModAdminExtraTest do
|
|||||||
|
|
||||||
test "get_last works" do
|
test "get_last works" do
|
||||||
|
|
||||||
assert 'Never' ==
|
assert {_, 'NOT FOUND'} =
|
||||||
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
||||||
|
|
||||||
EjabberdSmMock.connect_resource @user, @domain, @resource<>"1"
|
EjabberdSmMock.connect_resource @user, @domain, @resource<>"1"
|
||||||
EjabberdSmMock.connect_resource @user, @domain, @resource<>"2"
|
EjabberdSmMock.connect_resource @user, @domain, @resource<>"2"
|
||||||
|
|
||||||
assert 'Online' ==
|
assert {_, 'ONLINE'} =
|
||||||
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
||||||
|
|
||||||
EjabberdSmMock.disconnect_resource @user, @domain, @resource<>"1"
|
EjabberdSmMock.disconnect_resource @user, @domain, @resource<>"1"
|
||||||
|
|
||||||
assert 'Online' ==
|
assert {_, 'ONLINE'} =
|
||||||
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
||||||
|
|
||||||
now = {megasecs, secs, _microsecs} = :os.timestamp
|
now = {megasecs, secs, _microsecs} = :os.timestamp
|
||||||
timestamp = megasecs * 1000000 + secs
|
timestamp = megasecs * 1000000 + secs
|
||||||
EjabberdSmMock.disconnect_resource(@user, @domain, @resource<>"2",
|
EjabberdSmMock.disconnect_resource(@user, @domain, @resource<>"2",
|
||||||
timestamp)
|
timestamp)
|
||||||
{{year, month, day}, {hour, minute, second}} = :calendar.now_to_local_time now
|
{{year, month, day}, {hour, minute, second}} = :calendar.now_to_universal_time now
|
||||||
result = List.flatten(:io_lib.format(
|
result = IO.iodata_to_binary(:io_lib.format(
|
||||||
"~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w ",
|
"~w-~.2.0w-~.2.0wT~.2.0w:~.2.0w:~.2.0wZ",
|
||||||
[year, month, day, hour, minute, second]))
|
[year, month, day, hour, minute, second]))
|
||||||
assert result ==
|
assert {result, ""} ==
|
||||||
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
:ejabberd_commands.execute_command(:get_last, [@user, @domain])
|
||||||
|
|
||||||
assert :meck.validate :mod_last
|
assert :meck.validate :mod_last
|
||||||
|
Loading…
Reference in New Issue
Block a user