Commit | Line | Data |
---|---|---|
8581da38 | 1 | #!/usr/bin/perl |
2 | use strict; | |
3 | use warnings; | |
5e15a8a0 | 4 | use Email::MIME; |
5 | ||
6 | use Test::More; | |
8581da38 | 7 | |
8581da38 | 8 | use Email::Archive; |
ec413087 | 9 | use Email::Archive::Storage::DBIC; |
8581da38 | 10 | |
5e15a8a0 | 11 | my $email = Email::MIME->create( |
8581da38 | 12 | header => [ |
c5f5125c | 13 | From => 'foo@example.com', |
8581da38 | 14 | To => 'drain@example.com', |
15 | Subject => 'Message in a bottle', | |
16 | 'Message-ID' => 'helloworld', | |
17 | ], | |
18 | body => 'hello there!' | |
19 | ); | |
20 | ||
c5f5125c | 21 | my $e = Email::Archive->new(); |
5e15a8a0 | 22 | $e->connect('dbi:SQLite:dbname=t/test.db'); |
8581da38 | 23 | $e->store($email); |
24 | ||
25 | my $found = $e->retrieve('helloworld'); | |
5e15a8a0 | 26 | cmp_ok($found->header('subject'), 'eq', "Message in a bottle", |
27 | "can find stored message by ID"); | |
28 | ||
29 | done_testing; | |
20b4be81 | 30 | |
5e15a8a0 | 31 | unlink 't/test.db'; |
20b4be81 | 32 |