Skip to content

Commit

Permalink
Cassandane::Mboxname: self-test with dot/caret in mailbox name
Browse files Browse the repository at this point in the history
  • Loading branch information
elliefm committed Dec 9, 2024
1 parent 4a807b4 commit ad9ba33
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions cassandane/Cassandane/Test/Mboxname.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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]');
}
Expand All @@ -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]');
}
Expand All @@ -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]');
}
Expand Down Expand Up @@ -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 = $@;
Expand All @@ -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 = $@;
Expand All @@ -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);
Expand All @@ -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 = $@;
Expand All @@ -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]');
}
Expand All @@ -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]');
}
Expand Down Expand Up @@ -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');
}
Expand All @@ -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;

0 comments on commit ad9ba33

Please sign in to comment.