Skip to content

Commit

Permalink
spi-stats:fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Mar 21, 2024
1 parent 1e94d53 commit ef66316
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spi/spi-stats/tests/test_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async fn init_data() -> TardisResult<()> {
..Default::default()
};

let mut client = TestHttpClient::new(format!("https://127.0.0.1:8080/{}", DOMAIN_CODE));
let mut client = TestHttpClient::new(format!("http://localhost:8080/{}", DOMAIN_CODE));

client.set_auth(&ctx)?;

Expand Down
62 changes: 56 additions & 6 deletions spi/spi-stats/tests/test_stats_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
&StatsFactRecordLoadReq {
own_paths: "t1/a1".to_string(),
ct: Utc::now(),
data: json!({})
data: json!({}),
ext: json!({})
},
)
.await
Expand All @@ -127,9 +128,8 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
&StatsFactRecordLoadReq {
own_paths: "t1/a1".to_string(),
ct: Utc::now(),
data: json!({
"xx": 1
})
data: json!({"xx":1}),
ext: json!({"xx":1})
},
)
.await
Expand All @@ -147,6 +147,9 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
ct: Utc::now(),
data: json!({
"status": "openxxx"
}),
ext: json!({
"status": "openxxx"
})
},
)
Expand All @@ -165,6 +168,9 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
ct: Utc::now(),
data: json!({
"status": "open"
}),
ext: json!({
"status": "open"
})
},
)
Expand All @@ -188,6 +194,15 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
"act_hours": 40,
"plan_hours": 45
}),
ext: json!({
"source":"zhejiang",
"status": "open",
"priority":1,
"tag":["t1","t2"],
"creator":"acc001",
"act_hours": 40,
"plan_hours": 45
}),
},
)
.await;
Expand All @@ -206,6 +221,15 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
"act_hours": 15,
"plan_hours": 10
}),
ext: json!({
"source":"hangzhou",
"status": "open",
"priority":2,
"tag":["t1"],
"creator":"acc002",
"act_hours": 15,
"plan_hours": 10
}),
},
)
.await;
Expand All @@ -224,6 +248,9 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
data: json!({
"status": "progress",
}),
ext: json!({
"status": "progress",
}),
},
)
.await;
Expand All @@ -237,6 +264,9 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
data: json!({
"priority": 1,
}),
ext: json!({
"priority": 1,
}),
},
)
.await;
Expand All @@ -252,7 +282,8 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
key: "rec3".to_string(),
own_paths: "t1/a1".to_string(),
ct: Utc::now(),
data: json!({})
data: json!({}),
ext: json!({})
}],
)
.await
Expand All @@ -269,7 +300,8 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
key: "rec3".to_string(),
own_paths: "t1/a1".to_string(),
ct: Utc::now(),
data: json!({})
data: json!({}),
ext: json!({})
}],
)
.await
Expand Down Expand Up @@ -319,6 +351,15 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
"act_hours": 40,
"plan_hours": 45
}),
ext: json!({
"source":"zhejiang",
"status": "open",
"priority":1,
"tag":["t1","t2"],
"creator":"acc001",
"act_hours": 40,
"plan_hours": 45
}),
},
StatsFactRecordsLoadReq {
key: "rec4".to_string(),
Expand All @@ -333,6 +374,15 @@ pub async fn test_fact_record(client: &mut TestHttpClient) -> TardisResult<()> {
"act_hours": 40,
"plan_hours": 45
}),
ext: json!({
"source":"zhejiang",
"status": "open",
"priority":2,
"tag":["t1","t2"],
"creator":"acc001",
"act_hours": 40,
"plan_hours": 45
}),
},
],
)
Expand Down

0 comments on commit ef66316

Please sign in to comment.