BEGIN { use_ok(
'Net::Laconica'
) };
my
$laconica
;
dies_ok{
$laconica
= Net::Laconica->new }
'No arguments'
;
dies_ok{
$laconica
= Net::Laconica->new(
) }
'Correct uri, no username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
) }
'Wrong uri, no username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
uri
=>
'http/identi.ca'
) }
'Invalid uri, no username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai'
) }
'No uri, correct username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alanhaggaialavi'
) }
'No uri, wrong username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai-'
) }
'No uri, invalid username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
password
=>
'topsecret'
) }
'No uri, no username and wrong password'
;
ok(
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai'
),
'Correct uri ,correct username and no password'
);
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alan_haggai'
) }
'Correct uri, invalid username and no password'
;
ok(
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai'
),
'Wrong uri, correct username and no password'
);
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai-'
) }
'Wrong uri, invalid username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
uri
=>
'htt//alanhaggai.org'
,
username
=>
'alanhaggai'
) }
'Invalid uri, correct username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
uri
=>
'htt//alanhaggai.org'
,
username
=>
'alanhaggai-'
) }
'Invalid uri, invalid username and no password'
;
dies_ok{
$laconica
= Net::Laconica->new(
password
=>
'topsecret'
) }
'Correct uri, no username and wrong password'
;
dies_ok{
$laconica
= Net::Laconica->new(
password
=>
'topsecret'
) }
'Wrong uri, no username and wrong password'
;
dies_ok{
$laconica
= Net::Laconica->new(
uri
=>
'http:identi.ca'
,
password
=>
'topsecret'
) }
'Invalid uri, no username and wrong password'
;
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai'
,
password
=>
'topsecret'
) }
'No uri, correct username and wrong password'
;
dies_ok{
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai-'
,
password
=>
'topsecret'
) }
'No uri, invalid username and wrong password'
;
isa_ok(
$laconica
,
'Net::Laconica'
,
'Object created successfully'
);
$laconica
= Net::Laconica->new(
username
=>
'alanhaggai'
);
my
@messages
=
$laconica
->fetch;
ok(
@messages
>= 1,
'It is indeed an array'
);