236 236 | mod document_type_test {
|
237 237 |
|
238 238 | /// Serializes document types as part of the JSON request payload with no escaping.
|
239 239 | /// Test ID: DocumentTypeInputWithObject
|
240 240 | #[::tokio::test]
|
241 241 | #[::tracing_test::traced_test]
|
242 242 | async fn document_type_input_with_object_request() {
|
243 243 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
244 244 | let config_builder = crate::config::Config::builder()
|
245 245 | .with_test_defaults()
|
246 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
246 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
247 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
248 + | .allow_no_auth()
|
247 249 | .endpoint_url("https://example.com");
|
248 250 |
|
249 251 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
250 252 | let result = client
|
251 253 | .document_type()
|
252 254 | .set_string_value(::std::option::Option::Some("string".to_owned()))
|
253 255 | .set_document_value(::std::option::Option::Some({
|
254 256 | let json_bytes = br#"{
|
255 257 | "foo": "bar"
|
256 258 | }"#;
|
257 259 | let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
258 260 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
|
259 261 | }))
|
260 262 | .send()
|
261 263 | .await;
|
262 264 | let _ = dbg!(result);
|
263 265 | let http_request = request_receiver.expect_request();
|
264 266 | let expected_headers = [("Content-Type", "application/json")];
|
265 267 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
266 268 | let body = http_request.body().bytes().expect("body should be strict");
|
267 269 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
268 270 | body,
|
269 271 | "{\n \"stringValue\": \"string\",\n \"documentValue\": {\n \"foo\": \"bar\"\n }\n}",
|
270 272 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
271 273 | ));
|
272 274 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
273 275 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
274 276 | ::pretty_assertions::assert_eq!(uri.path(), "/DocumentType", "path was incorrect");
|
275 277 | }
|
276 278 |
|
277 279 | /// Serializes document types using a string.
|
278 280 | /// Test ID: DocumentInputWithString
|
279 281 | #[::tokio::test]
|
280 282 | #[::tracing_test::traced_test]
|
281 283 | async fn document_input_with_string_request() {
|
282 284 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
283 285 | let config_builder = crate::config::Config::builder()
|
284 286 | .with_test_defaults()
|
285 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
287 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
288 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
289 + | .allow_no_auth()
|
286 290 | .endpoint_url("https://example.com");
|
287 291 |
|
288 292 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
289 293 | let result = client
|
290 294 | .document_type()
|
291 295 | .set_string_value(::std::option::Option::Some("string".to_owned()))
|
292 296 | .set_document_value(::std::option::Option::Some({
|
293 297 | let json_bytes = br#""hello""#;
|
294 298 | let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
295 299 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
|
296 300 | }))
|
297 301 | .send()
|
298 302 | .await;
|
299 303 | let _ = dbg!(result);
|
300 304 | let http_request = request_receiver.expect_request();
|
301 305 | let expected_headers = [("Content-Type", "application/json")];
|
302 306 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
303 307 | let body = http_request.body().bytes().expect("body should be strict");
|
304 308 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
305 309 | body,
|
306 310 | "{\n \"stringValue\": \"string\",\n \"documentValue\": \"hello\"\n}",
|
307 311 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
308 312 | ));
|
309 313 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
310 314 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
311 315 | ::pretty_assertions::assert_eq!(uri.path(), "/DocumentType", "path was incorrect");
|
312 316 | }
|
313 317 |
|
314 318 | /// Serializes document types using a number.
|
315 319 | /// Test ID: DocumentInputWithNumber
|
316 320 | #[::tokio::test]
|
317 321 | #[::tracing_test::traced_test]
|
318 322 | async fn document_input_with_number_request() {
|
319 323 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
320 324 | let config_builder = crate::config::Config::builder()
|
321 325 | .with_test_defaults()
|
322 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
326 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
327 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
328 + | .allow_no_auth()
|
323 329 | .endpoint_url("https://example.com");
|
324 330 |
|
325 331 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
326 332 | let result = client
|
327 333 | .document_type()
|
328 334 | .set_string_value(::std::option::Option::Some("string".to_owned()))
|
329 335 | .set_document_value(::std::option::Option::Some({
|
330 336 | let json_bytes = br#"10"#;
|
331 337 | let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
332 338 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
|
333 339 | }))
|
334 340 | .send()
|
335 341 | .await;
|
336 342 | let _ = dbg!(result);
|
337 343 | let http_request = request_receiver.expect_request();
|
338 344 | let expected_headers = [("Content-Type", "application/json")];
|
339 345 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
340 346 | let body = http_request.body().bytes().expect("body should be strict");
|
341 347 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
342 348 | body,
|
343 349 | "{\n \"stringValue\": \"string\",\n \"documentValue\": 10\n}",
|
344 350 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
345 351 | ));
|
346 352 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
347 353 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
348 354 | ::pretty_assertions::assert_eq!(uri.path(), "/DocumentType", "path was incorrect");
|
349 355 | }
|
350 356 |
|
351 357 | /// Serializes document types using a boolean.
|
352 358 | /// Test ID: DocumentInputWithBoolean
|
353 359 | #[::tokio::test]
|
354 360 | #[::tracing_test::traced_test]
|
355 361 | async fn document_input_with_boolean_request() {
|
356 362 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
357 363 | let config_builder = crate::config::Config::builder()
|
358 364 | .with_test_defaults()
|
359 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
365 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
366 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
367 + | .allow_no_auth()
|
360 368 | .endpoint_url("https://example.com");
|
361 369 |
|
362 370 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
363 371 | let result = client
|
364 372 | .document_type()
|
365 373 | .set_string_value(::std::option::Option::Some("string".to_owned()))
|
366 374 | .set_document_value(::std::option::Option::Some({
|
367 375 | let json_bytes = br#"true"#;
|
368 376 | let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
369 377 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
|
370 378 | }))
|
371 379 | .send()
|
372 380 | .await;
|
373 381 | let _ = dbg!(result);
|
374 382 | let http_request = request_receiver.expect_request();
|
375 383 | let expected_headers = [("Content-Type", "application/json")];
|
376 384 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
377 385 | let body = http_request.body().bytes().expect("body should be strict");
|
378 386 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
379 387 | body,
|
380 388 | "{\n \"stringValue\": \"string\",\n \"documentValue\": true\n}",
|
381 389 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
382 390 | ));
|
383 391 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
384 392 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
385 393 | ::pretty_assertions::assert_eq!(uri.path(), "/DocumentType", "path was incorrect");
|
386 394 | }
|
387 395 |
|
388 396 | /// Serializes document types using a list.
|
389 397 | /// Test ID: DocumentInputWithList
|
390 398 | #[::tokio::test]
|
391 399 | #[::tracing_test::traced_test]
|
392 400 | async fn document_input_with_list_request() {
|
393 401 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
394 402 | let config_builder = crate::config::Config::builder()
|
395 403 | .with_test_defaults()
|
396 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
404 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
405 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
406 + | .allow_no_auth()
|
397 407 | .endpoint_url("https://example.com");
|
398 408 |
|
399 409 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
400 410 | let result = client
|
401 411 | .document_type()
|
402 412 | .set_string_value(::std::option::Option::Some("string".to_owned()))
|
403 413 | .set_document_value(::std::option::Option::Some({
|
404 414 | let json_bytes = br#"[
|
405 415 | true,
|
406 416 | "hi",
|