This repository was archived by the owner on Feb 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/lib/api_app/src/tests/api_utils_test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use mockito:: Server ;
12use std:: collections:: HashMap ;
3+ use std:: env;
24
35use crate :: api:: routes:: testbed:: productizers:: job:: {
46 construct_productizer_requests,
@@ -34,8 +36,8 @@ fn test_jobs_response_handlings() {
3436 assert_eq ! ( transformed_results. len( ) , 3 ) ;
3537}
3638
37- #[ test]
38- fn test_request_parsing ( ) {
39+ #[ tokio :: test]
40+ async fn test_request_parsing ( ) {
3941 let endpoint_urls = vec ! [ String :: from( "http1" ) , String :: from( "http2" ) ] ;
4042
4143 let mut headers = HeaderMap :: new ( ) ;
@@ -71,7 +73,20 @@ fn test_request_parsing() {
7173 . to_string ( ) ,
7274 } ;
7375
76+ let mut server = Server :: new_async ( ) . await ;
77+ server. mock ( "GET" , "/resources/OccupationsEscoURL" )
78+ . with_status ( 200 )
79+ . with_header ( "content-type" , "application/json" )
80+ . with_body ( json ! ( [
81+ {
82+ "uri" : "http://data.europa.eu/esco/occupation/0c5e3b5a-1b1f-4b0e-8d0c-4c4c4c4c4c4c" ,
83+ }
84+ ] ) . to_string ( ) )
85+ . create_async ( ) . await ;
86+ env:: set_var ( "CODESETS_BASE_URL" , server. url ( ) ) ;
87+
7488 let request = construct_productizer_requests ( request_input, endpoint_urls)
89+ . await
7590 . expect ( "Failed to construct the productizer requests" ) ;
7691
7792 assert_eq ! ( request. endpoint_urls. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments