summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Model/ReadMails/MockJSON.pm
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-09-08 23:32:10 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-09-08 23:32:10 +0200
commit926ec7a6b85e6e3f7335a8c5ddcccd51937ee2d8 (patch)
treeb7a420a919d0146f2a0bd2e1e577b795fcb99202 /lib/JWebmail/Model/ReadMails/MockJSON.pm
parent4510e3720274865996ef056f1687997ba0b482be (diff)
added a build configuration step
Diffstat (limited to 'lib/JWebmail/Model/ReadMails/MockJSON.pm')
-rw-r--r--lib/JWebmail/Model/ReadMails/MockJSON.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/JWebmail/Model/ReadMails/MockJSON.pm b/lib/JWebmail/Model/ReadMails/MockJSON.pm
index 64d6873..9ad5f09 100644
--- a/lib/JWebmail/Model/ReadMails/MockJSON.pm
+++ b/lib/JWebmail/Model/ReadMails/MockJSON.pm
@@ -21,14 +21,12 @@ use constant {
with 'JWebmail::Model::ReadMails::Role';
-sub new { bless {}, shift }
+sub new { bless {%$_[1]}, shift }
sub _read_json_file {
- my ($file_name) = @_;
+ my ($self, $file_name) = @_;
- use constant PREFIX => 't/testdata/json/';
-
- open my $body_file, '<', PREFIX . $file_name;
+ open my $body_file, '<', $self->{mailbox_path} . '/' . $file_name;
local $/;
my $body = <$body_file>;
close $body_file;
@@ -37,13 +35,15 @@ sub _read_json_file {
}
sub list_reply {
- state $init = _read_json_file('msgs.json');
+ my $self = shift;
+ state $init = _read_json_file($self, 'msgs.json');
}
sub read_reply {
+ my $self = shift;
state $init = {
- 'SC-ORD-MAIL54526c63b751646618a793be3f8329cca@sc-ord-mail5' => _read_json_file('msg2.json'),
- 'example' => _read_json_file('msg.json'),
+ 'SC-ORD-MAIL54526c63b751646618a793be3f8329cca@sc-ord-mail5' => _read_json_file($self, 'msg2.json'),
+ 'example' => _read_json_file($self, 'msg.json'),
};
}