Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit 01d93a8

Browse files
committed
fix: bad merge
1 parent e3f3b35 commit 01d93a8

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

  • src/lib/api_app/src/tests/api_utils_test

src/lib/api_app/src/tests/api_utils_test/mod.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
use mockito::Server;
12
use std::collections::HashMap;
3+
use std::env;
24

35
use 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);

0 commit comments

Comments
 (0)