4 use Test
::More tests
=> 9;
6 use Fedora
::Rebuild
::Repository
;
13 my $directory = File
::Temp
::tempdir
(CLEANUP
=> 1);
14 ok
($directory, 'temporary directory created');
16 my $repository = Fedora
::Rebuild
::Repository
->new(path
=>$directory);
17 ok
($repository, 'Fedora::Rebuild::Repository object created');
19 my $url = $repository->start;
20 ok
($url, 'repository server started');
22 my $file_name = 'c++';
23 my $file_content = '42';
24 my $file = File
::Spec
->catfile($directory, $file_name);
25 ok
(open(my $fh, '>', $file), "file '$file_name' created");
26 print $fh $file_content;
27 ok
(close($fh), "content written");
29 my $file_name_escaped = URI
::Escape
::uri_escape_utf8
($file_name);
30 my $response = HTTP
::Tiny
->new->get(URI
->new_abs($file_name_escaped, $url));
31 ok
($response, "GET request for escaped '$file_name_escaped' sent");
33 ok
($response->{success
},
34 "file '$file_name' retrieved: $response->{status} $response->{reason}");
35 is
($response->{content
}, $file_content, 'file content matches');
38 pass
('repository server stopped');