Skip to content

Commit

Permalink
test(object): 修复单测
Browse files Browse the repository at this point in the history
  • Loading branch information
tu6ge committed Mar 9, 2023
1 parent c006da4 commit ecc6cc0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ mod tests {
let object_list = init_object_list(Some(String::from("foo3")), vec![]);
assert_eq!(
format!("{object_list:?}"),
"ObjectList { bucket: BucketBase { endpoint: CnShanghai, name: BucketName(\"abc\") }, prefix: \"foo2\", max_keys: 100, key_count: 200, next_continuation_token: Some(\"foo3\"), common_prefixes: [], search_query: Query { inner: {Custom(\"key1\"): QueryValue(\"value1\")} } }"
"ObjectList { bucket: BucketBase { endpoint: CnShanghai, name: BucketName(\"abc\") }, prefix: Some(ObjectDir(\"foo2/\")), max_keys: 100, key_count: 200, next_continuation_token: Some(\"foo3\"), common_prefixes: [], search_query: Query { inner: {Custom(\"key1\"): QueryValue(\"value1\")} } }"
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/tests/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn test_get_bucket_list() {
//println!("{:?}", res);
assert_eq!(
format!("{:?}", res),
r#"Ok(ListBuckets { prefix: None, marker: None, max_keys: 0, is_truncated: false, next_marker: None, id: None, display_name: None, buckets: [] })"#
r#"Ok(ListBuckets { prefix: "", marker: "", max_keys: 0, is_truncated: false, next_marker: "", id: "", display_name: "", buckets: [] })"#
);
}

Expand Down Expand Up @@ -106,7 +106,7 @@ fn test_get_blocking_bucket_list() {
//println!("{:?}", res);
assert_eq!(
format!("{:?}", res),
r#"Ok(ListBuckets { prefix: None, marker: None, max_keys: 0, is_truncated: false, next_marker: None, id: None, display_name: None, buckets: [] })"#
r#"Ok(ListBuckets { prefix: "", marker: "", max_keys: 0, is_truncated: false, next_marker: "", id: "", display_name: "", buckets: [] })"#
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/tests/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn object_list_get_object_list() {
r#"<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult>
<Name>barname</Name>
<Prefix></Prefix>
<Prefix>foo2</Prefix>
<MaxKeys>100</MaxKeys>
<Delimiter></Delimiter>
<IsTruncated>false</IsTruncated>
Expand Down Expand Up @@ -96,7 +96,7 @@ fn object_list_get_object_list() {

let mut object_list = ObjectList::<RcPointer>::new(
"abc.oss-cn-shanghai.aliyuncs.com".parse().unwrap(),
String::from("foo2"),
Some("foo2/".parse().unwrap()),
100,
200,
Vec::new(),
Expand All @@ -113,7 +113,7 @@ fn object_list_get_object_list() {
list,
EndPoint::CnShanghai,
"abc".parse().unwrap(),
"".to_string(),
Some("foo2/".parse().unwrap()),
100,
23,
None,
Expand Down
4 changes: 2 additions & 2 deletions src/tests/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ mod object_list_xml {
Ok(())
}
fn set_prefix(&mut self, prefix: &str) -> Result<(), MyError> {
assert_eq!(prefix, "");
assert_eq!(prefix, "foo_prefix");
Ok(())
}
fn set_max_keys(&mut self, max_keys: &str) -> Result<(), MyError> {
Expand All @@ -131,7 +131,7 @@ mod object_list_xml {
let xml = r#"<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult>
<Name>foo_bucket</Name>
<Prefix></Prefix>
<Prefix>foo_prefix</Prefix>
<MaxKeys>100</MaxKeys>
<Delimiter></Delimiter>
<IsTruncated>false</IsTruncated>
Expand Down

0 comments on commit ecc6cc0

Please sign in to comment.