@@ -15,21 +15,21 @@ pub struct TestCase {
15
15
}
16
16
17
17
impl TestCase {
18
- pub async fn new ( request_file_name : & str , response_file_name : & str ) -> TestCase {
19
- let request_fixture = File :: open ( fixture_path ( & request_file_name ) )
18
+ pub async fn new ( request_file_path : & str , response_file_path : & str ) -> TestCase {
19
+ let request_fixture = File :: open ( fixture_path ( & request_file_path ) )
20
20
. await
21
21
. expect ( & format ! (
22
- "Could not open request fixture file: {}" ,
23
- request_file_name
22
+ "Could not open request fixture file: {:? }" ,
23
+ & fixture_path ( request_file_path )
24
24
) ) ;
25
25
let request_fixture = Arc :: new ( request_fixture) ;
26
26
27
27
let response_fixture =
28
- File :: open ( fixture_path ( & response_file_name ) )
28
+ File :: open ( fixture_path ( & response_file_path ) )
29
29
. await
30
30
. expect ( & format ! (
31
- "Could not open response fixture file: {}" ,
32
- response_file_name
31
+ "Could not open response fixture file: {:? }" ,
32
+ & fixture_path ( response_file_path )
33
33
) ) ;
34
34
let response_fixture = Arc :: new ( Mutex :: new ( response_fixture) ) ;
35
35
@@ -94,10 +94,9 @@ impl TestCase {
94
94
}
95
95
}
96
96
97
- fn fixture_path ( name : & str ) -> PathBuf {
97
+ fn fixture_path ( relative_path : & str ) -> PathBuf {
98
98
let directory: PathBuf = env ! ( "CARGO_MANIFEST_DIR" ) . into ( ) ;
99
- let relative_path: PathBuf = format ! ( "tests/fixtures/{}.txt" , name) . into ( ) ;
100
- directory. join ( relative_path)
99
+ directory. join ( "tests" ) . join ( relative_path)
101
100
}
102
101
103
102
impl Read for TestCase {
0 commit comments