Skip to content

Commit

Permalink
open-api: fix bug && update test (#702)
Browse files Browse the repository at this point in the history
* open-api: fix bug

* update
  • Loading branch information
ZzIsGod1019 authored Apr 9, 2024
1 parent 5261263 commit 3cdcc1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions backend/supports/iam/src/basic/serv/iam_open_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ impl IamOpenServ {
// let spec_id = IamRelServ::find_from_id_rels(&IamRelKind::IamCertSpec, false, &cert_id, None, None, funs, ctx).await?.pop().unwrap_or_default();
let spec_id = RbumRelServ::find_detail_rbums(
&RbumRelFilterReq {
basic: RbumBasicFilterReq {
with_sub_own_paths: true,
..Default::default()
},
from_rbum_id: Some(cert_id.to_string()),
from_rbum_kind: Some(RbumRelFromKind::Cert),
tag: Some(IamRelKind::IamCertSpec.to_string()),
Expand All @@ -463,6 +467,7 @@ impl IamOpenServ {
let spec_code = IamResServ::find_one_detail_item(
&IamResFilterReq {
basic: RbumBasicFilterReq {
with_sub_own_paths: true,
ids: Some(vec![spec_id]),
..Default::default()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl IamCiOpenApi {

/// Get account rule info / 获取账号规则信息
#[oai(path = "/", method = "get")]
async fn get_rule_info(&self, cert_id: Query<Option<String>>, ak: Query<Option<String>>, request: &Request) -> TardisApiResult<IamOpenRuleResp> {
async fn get_rule_info(&self, cert_id: Query<Option<String>>, ak: Query<Option<String>>, _request: &Request) -> TardisApiResult<IamOpenRuleResp> {
let mut funs = iam_constants::get_tardis_inst();
let global_ctx = TardisContext {
own_paths: "".to_string(),
Expand Down
6 changes: 5 additions & 1 deletion backend/supports/iam/tests/test_ci_open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ pub async fn test(context1: &TardisContext) -> TardisResult<()> {
)
.await?;
info!("【test_ci_open】 : Get account info");
let info = IamOpenServ::get_rule_info(Some(cert_id.clone()), None, &funs, context1).await?;
let global_ctx = TardisContext {
own_paths: "".to_string(),
..Default::default()
};
let info = IamOpenServ::get_rule_info(Some(cert_id.clone()), None, &funs, &global_ctx).await?;
assert_eq!(info.cert_id, cert_id.clone());
assert_eq!(info.spec_code, spec1_code.clone());
assert_eq!(info.api_call_frequency, Some(500));
Expand Down

0 comments on commit 3cdcc1b

Please sign in to comment.