-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cassandane::Mboxname: self-test with dot/caret in mailbox name
- Loading branch information
Showing
1 changed file
with
51 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,20 +79,20 @@ sub test_parts_ctor | |
my $mb = Cassandane::Mboxname->new( | ||
domain => 'quinoa.com', | ||
userid => 'pickled', | ||
box => 'fanny.pack'); | ||
box => 'pants.waist^band'); | ||
$self->assert_str_equals($mb->domain, 'quinoa.com'); | ||
$self->assert_str_equals($mb->userid, 'pickled'); | ||
$self->assert_str_equals($mb->box, 'fanny.pack'); | ||
$self->assert_str_equals($mb->box, 'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external, | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('admin'), | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('owner'), | ||
'fanny.pack'); | ||
'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external('other'), | ||
'Other Users.pickled@quinoa^com.fanny.pack'); | ||
'Other Users.pickled@quinoa^com.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_username, | ||
'[email protected]'); | ||
} | ||
|
@@ -103,20 +103,20 @@ sub test_internal_ctor | |
|
||
my $mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
internal => 'quinoa.com!user.pickled.fanny.pack'); | ||
internal => 'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->domain, 'quinoa.com'); | ||
$self->assert_str_equals($mb->userid, 'pickled'); | ||
$self->assert_str_equals($mb->box, 'fanny.pack'); | ||
$self->assert_str_equals($mb->box, 'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external, | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('admin'), | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('owner'), | ||
'fanny.pack'); | ||
'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external('other'), | ||
'Other Users.pickled@quinoa^com.fanny.pack'); | ||
'Other Users.pickled@quinoa^com.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_username, | ||
'[email protected]'); | ||
} | ||
|
@@ -127,20 +127,20 @@ sub test_external_ctor | |
|
||
my $mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
external => 'user.pickled.fanny.pack@quinoa.com'); | ||
external => 'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->domain, 'quinoa.com'); | ||
$self->assert_str_equals($mb->userid, 'pickled'); | ||
$self->assert_str_equals($mb->box, 'fanny.pack'); | ||
$self->assert_str_equals($mb->box, 'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
$self->assert_str_equals($mb->to_external), | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external, | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('admin'), | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('owner'), | ||
'fanny.pack'); | ||
'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external('other'), | ||
'Other Users.pickled@quinoa^com.fanny.pack'); | ||
'Other Users.pickled@quinoa^com.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_username, | ||
'[email protected]'); | ||
} | ||
|
@@ -179,7 +179,7 @@ sub test_broken_ctor | |
{ | ||
$mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
internal => 'quinoa.com!user.pickled.fanny.pack', | ||
internal => 'quinoa.com!user.pickled.pants.waist^band', | ||
username => '[email protected]'); | ||
}; | ||
$ex = $@; | ||
|
@@ -189,7 +189,7 @@ sub test_broken_ctor | |
{ | ||
$mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
external => 'user.pickled.fanny.pack@quinoa.com', | ||
external => 'user.pickled.pants.waist^band@quinoa.com', | ||
username => '[email protected]'); | ||
}; | ||
$ex = $@; | ||
|
@@ -199,8 +199,8 @@ sub test_broken_ctor | |
{ | ||
$mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
internal => 'quinoa.com!user.pickled.fanny.pack', | ||
external => 'user.pickled.fanny.pack@quinoa.com'); | ||
internal => 'quinoa.com!user.pickled.pants.waist^band', | ||
external => 'user.pickled.pants.waist^band@quinoa.com'); | ||
}; | ||
$ex = $@; | ||
$self->assert_matches(qr/contradictory initialisers/, $ex); | ||
|
@@ -209,7 +209,7 @@ sub test_broken_ctor | |
{ | ||
$mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
internal => 'quinoa.com!user.pickled.fanny.pack', | ||
internal => 'quinoa.com!user.pickled.pants.waist^band', | ||
selvage => 'sustainble'); | ||
}; | ||
$ex = $@; | ||
|
@@ -221,20 +221,20 @@ sub test_from_internal | |
my ($self) = @_; | ||
|
||
my $mb = Cassandane::Mboxname->new(config => myconfig()); | ||
$mb->from_internal('quinoa.com!user.pickled.fanny.pack'); | ||
$mb->from_internal('quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->domain, 'quinoa.com'); | ||
$self->assert_str_equals($mb->userid, 'pickled'); | ||
$self->assert_str_equals($mb->box, 'fanny.pack'); | ||
$self->assert_str_equals($mb->box, 'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external, | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('admin'), | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('owner'), | ||
'fanny.pack'); | ||
'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external('other'), | ||
'Other Users.pickled@quinoa^com.fanny.pack'); | ||
'Other Users.pickled@quinoa^com.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_username, | ||
'[email protected]'); | ||
} | ||
|
@@ -244,20 +244,20 @@ sub test_from_external | |
my ($self) = @_; | ||
|
||
my $mb = Cassandane::Mboxname->new(config => myconfig()); | ||
$mb->from_external('user.pickled.fanny.pack@quinoa.com'); | ||
$mb->from_external('user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->domain, 'quinoa.com'); | ||
$self->assert_str_equals($mb->userid, 'pickled'); | ||
$self->assert_str_equals($mb->box, 'fanny.pack'); | ||
$self->assert_str_equals($mb->box, 'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external, | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('admin'), | ||
'user.pickled.fanny.pack@quinoa.com'); | ||
'user.pickled.pants.waist^band@quinoa.com'); | ||
$self->assert_str_equals($mb->to_external('owner'), | ||
'fanny.pack'); | ||
'pants.waist^band'); | ||
$self->assert_str_equals($mb->to_external('other'), | ||
'Other Users.pickled@quinoa^com.fanny.pack'); | ||
'Other Users.pickled@quinoa^com.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_username, | ||
'[email protected]'); | ||
} | ||
|
@@ -295,17 +295,17 @@ sub test_make_child | |
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled'); | ||
|
||
my $mb2 = $mb->make_child('fanny'); | ||
my $mb2 = $mb->make_child('pants'); | ||
$self->assert_str_equals($mb2->to_internal, | ||
'quinoa.com!user.pickled.fanny'); | ||
'quinoa.com!user.pickled.pants'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled'); | ||
|
||
my $mb3 = $mb2->make_child('pack'); | ||
my $mb3 = $mb2->make_child('waist^band'); | ||
$self->assert_str_equals($mb3->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb2->to_internal, | ||
'quinoa.com!user.pickled.fanny'); | ||
'quinoa.com!user.pickled.pants'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled'); | ||
} | ||
|
@@ -316,27 +316,27 @@ sub test_make_parent | |
|
||
my $mb = Cassandane::Mboxname->new( | ||
config => myconfig(), | ||
internal => 'quinoa.com!user.pickled.fanny.pack'); | ||
internal => 'quinoa.com!user.pickled.pants.waist^band'); | ||
$self->assert_str_equals($mb->to_internal, | ||
'quinoa.com!user.pickled.fanny.pack'); | ||
'quinoa.com!user.pickled.pants.waist^band'); | ||
|
||
my $mb2 = $mb->make_parent(); | ||
$self->assert_str_equals($mb2->to_internal, | ||
'quinoa.com!user.pickled.fanny'); | ||
'quinoa.com!user.pickled.pants'); | ||
|
||
my $mb3 = $mb2->make_parent(); | ||
$self->assert_str_equals($mb3->to_internal, | ||
'quinoa.com!user.pickled'); | ||
$self->assert_str_equals($mb2->to_internal, | ||
'quinoa.com!user.pickled.fanny'); | ||
'quinoa.com!user.pickled.pants'); | ||
|
||
my $mb4 = $mb3->make_parent(); | ||
$self->assert_str_equals($mb4->to_internal, | ||
'quinoa.com!user.pickled'); | ||
$self->assert_str_equals($mb3->to_internal, | ||
'quinoa.com!user.pickled'); | ||
$self->assert_str_equals($mb2->to_internal, | ||
'quinoa.com!user.pickled.fanny'); | ||
'quinoa.com!user.pickled.pants'); | ||
} | ||
|
||
1; |