mod common;
use hotdata::apis::workspaces_api;
use hotdata::Configuration;
#[tokio::test]
async fn auth_missing_token_401() {
let _client = skip_if_no_creds!();
let env = common::load_env();
let mut config = Configuration::new();
config.base_path = env.api_url.trim_end_matches('/').to_string();
let result = workspaces_api::list_workspaces(&config, None).await;
match result {
Err(err) => {
assert_eq!(
common::status_of(&err),
Some(401),
"expected 401 without bearer token, got {err:?}"
);
if let hotdata::Error::ResponseError(content) = &err {
assert!(
!content.content.is_empty(),
"expected non-empty error body on 401"
);
}
}
Ok(_) => panic!("list_workspaces without a token must not succeed"),
}
}