Bot-Backbone-Service-SlackChat
view release on metacpan or search on metacpan
t/10-connect.t view on Meta::CPAN
313233343536373839404142434445464748495051
token
=>
$RECVBOT_TOKEN
,
channel
=>
$CHANNEL
,
);
my
$sendbot
= TestBot::SingleSend->new(
ready
=>
$ready
,
say_code
=>
substr
(
''
.
rand
, 2),
token
=>
$SENDBOT_TOKEN
,
channel
=>
$CHANNEL
,
);
my
$t
= AnyEvent->timer(
after
=> 10,
cb
=>
sub
{
fail(
"test took too long"
);
$done
->
send
;
});
$recvbot
->run;
$sendbot
->run;
$done
->
recv
;
is(
$recvbot
->saw_code,
$sendbot
->say_code,
'bots exchanged data'
);
t/20-on_channel_joined-init.t view on Meta::CPAN
313233343536373839404142434445464748495051
token
=>
$RECVBOT_TOKEN
,
channel
=>
$CHANNEL
,
);
my
$sendbot
= TestBot::SingleSendJoin->new(
ready
=>
$ready
,
say_code
=>
substr
(
''
.
rand
, 2),
token
=>
$SENDBOT_TOKEN
,
channel
=>
$CHANNEL
,
);
my
$t
= AnyEvent->timer(
after
=> 10,
cb
=>
sub
{
fail(
"test took too long"
);
$done
->
send
;
});
$recvbot
->run;
$sendbot
->run;
$done
->
recv
;
ok(
$recvbot
->during_init,
'recvbot invite happened at startup'
);
t/22-on_channel_joined-live.t view on Meta::CPAN
515253545556575859606162636465666768697071727374757677787980
token
=>
$RECVBOT_TOKEN
,
channel
=>
$CHANNEL
,
);
my
$sendbot
= TestBot::SingleSendJoin->new(
ready
=>
$ready
,
say_code
=>
substr
(
''
.
rand
, 2),
token
=>
$SENDBOT_TOKEN
,
channel
=>
$CHANNEL
,
);
my
$t
= AnyEvent->timer(
after
=> 10,
cb
=>
sub
{
fail(
"test took too long"
);
exit
(1);
});
$recvbot
->run;
$sendbot
->run;
my
$t2
;
$t2
= AnyEvent->timer(
interval
=> 0.5,
cb
=>
sub
{
return
unless
$recvbot
->get_service(
'slack_chat'
)->rtm->said_hello;
return
unless
$sendbot
->get_service(
'slack_chat'
)->rtm->said_hello;
#warn "# INVITE RECVBOT\n";
$slack
->channels->invite(
channel
=>
$CHANNEL
,
user
=>
$RECVBOT_USER
,
);
undef
$t2
;
t/lib/TestBot/SingleSendJoin.pm view on Meta::CPAN
596061626364656667686970717273747576777879
$joined
->
send
;
},
);
super;
# We need to wait until Bot::Backbone has had a chance to instantiate the
# service before we can work with it.
$joined
->cb(
sub
{
$self
->_t(
AnyEvent->timer(
after
=> 1,
cb
=>
sub
{
$self
->ready->
recv
;
#warn "# SENDING\n";
$self
->get_service(
'test_group'
)->send_message({
text
=>
"!hello "
.
$self
->say_code,
});
$self
->
shutdown
;
})
);
( run in 0.319 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )