3 use App::EzPz::UserStore;
4 use File::Temp qw(tempfile);
6 my $us = App::EzPz::UserStore->new(htpasswd_file => (tempfile)[1]);
8 my $mst = $us->add({ username => 'mst', password => 'boromir' });
10 is($mst->username, 'mst', 'username ok');
11 ok($mst->check_password('boromir'), 'right pw ok on user');
12 ok(!$mst->check_password('gimli'), 'wrong pw not ok on user');
14 ok($us->check_password('mst', 'boromir'), 'right pw ok on user store');
15 ok(!$us->check_password('mst', 'gimli'), 'wrong pw not ok on user store');
17 ok(!$us->check_password('genehack', 'boromir'), 'nonexistent user fails ok');
19 my $mst_clone = $us->add({ username => 'an_mst_clone', password => 'dnatank' });
22 join(',', sort map $_->username, $us->all),
24 'user list ok with 2 users'
27 $us->remove($mst_clone);
30 join(',', sort map $_->username, $us->all),
32 'user list ok after delete'
36 join(',', $mst->list_names), '',
40 $mst->add_list_name($_) for qw(list1 list2 list3);
43 join(',', $mst->list_names), 'list1,list2,list3',
44 'Three lists after add',
47 $mst->remove_list_name('list2');
50 join(',', $mst->list_names), 'list1,list3',
51 'Two lists after move',
54 $mst->add_list_name('list2');
57 join(',', $mst->list_names), 'list1,list3,list2',