|
| 1 | +import json |
| 2 | + |
1 | 3 | import responses |
2 | 4 | from responses import matchers |
3 | 5 |
|
|
18 | 20 | from tests.helpers import ( |
19 | 21 | ClientTestCase, |
20 | 22 | create_headers_for_test, |
21 | | - make_string_to_single_line, |
22 | 23 | ) |
23 | 24 |
|
24 | 25 |
|
@@ -345,17 +346,17 @@ def test_create_custom_metadata_fields_succeeds_with_type_number(self): |
345 | 346 | }, |
346 | 347 | } |
347 | 348 |
|
348 | | - request_body = make_string_to_single_line( |
| 349 | + request_body = json.dumps(json.loads( |
349 | 350 | """{ |
350 | | - "name": "test", |
351 | | - "label": "test", |
352 | | - "schema": { |
353 | | - "type": "Number", |
354 | | - "minValue": 100, |
355 | | - "maxValue": 200 |
356 | | - } |
357 | | - }""" |
358 | | - ) |
| 351 | + "name": "test", |
| 352 | + "label": "test", |
| 353 | + "schema": { |
| 354 | + "type": "Number", |
| 355 | + "minValue": 100, |
| 356 | + "maxValue": 200 |
| 357 | + } |
| 358 | + }""" |
| 359 | + )) |
359 | 360 | self.assertEqual( |
360 | 361 | camel_dict_to_snake_dict(mock_response_metadata), |
361 | 362 | resp.response_metadata.__dict__, |
@@ -427,19 +428,19 @@ def test_create_custom_metadata_fields_succeeds_with_type_textarea(self): |
427 | 428 | }, |
428 | 429 | } |
429 | 430 |
|
430 | | - request_body = make_string_to_single_line( |
| 431 | + request_body = json.dumps(json.loads( |
431 | 432 | """{ |
432 | | - "name": "test", |
433 | | - "label": "test", |
434 | | - "schema": { |
435 | | - "type": "Textarea", |
436 | | - "defaultValue": "The", |
437 | | - "isValueRequired": true, |
438 | | - "minLength": 3, |
439 | | - "maxLength": 200 |
440 | | - } |
441 | | - }""" |
442 | | - ) |
| 433 | + "name": "test", |
| 434 | + "label": "test", |
| 435 | + "schema": { |
| 436 | + "type": "Textarea", |
| 437 | + "defaultValue": "The", |
| 438 | + "isValueRequired": true, |
| 439 | + "minLength": 3, |
| 440 | + "maxLength": 200 |
| 441 | + } |
| 442 | + }""" |
| 443 | + )) |
443 | 444 | self.assertEqual( |
444 | 445 | camel_dict_to_snake_dict(mock_response_metadata), |
445 | 446 | resp.response_metadata.__dict__, |
@@ -505,17 +506,17 @@ def test_create_custom_metadata_fields_succeeds_with_type_date(self): |
505 | 506 | }, |
506 | 507 | } |
507 | 508 |
|
508 | | - request_body = make_string_to_single_line( |
| 509 | + request_body = json.dumps(json.loads( |
509 | 510 | """{ |
510 | | - "name": "test-date", |
511 | | - "label": "test-date", |
512 | | - "schema": { |
513 | | - "type": "Date", |
514 | | - "minValue": "2022-11-29T10:11:10+00:00", |
515 | | - "maxValue": "2022-11-30T10:11:10+00:00" |
516 | | - } |
517 | | - }""" |
518 | | - ) |
| 511 | + "name": "test-date", |
| 512 | + "label": "test-date", |
| 513 | + "schema": { |
| 514 | + "type": "Date", |
| 515 | + "minValue": "2022-11-29T10:11:10+00:00", |
| 516 | + "maxValue": "2022-11-30T10:11:10+00:00" |
| 517 | + } |
| 518 | + }""" |
| 519 | + )) |
519 | 520 | self.assertEqual( |
520 | 521 | camel_dict_to_snake_dict(mock_response_metadata), |
521 | 522 | resp.response_metadata.__dict__, |
@@ -581,17 +582,17 @@ def test_create_custom_metadata_fields_succeeds_with_type_boolean(self): |
581 | 582 | }, |
582 | 583 | } |
583 | 584 |
|
584 | | - request_body = make_string_to_single_line( |
| 585 | + request_body = json.dumps(json.loads( |
585 | 586 | """{ |
586 | | - "name": "test-boolean", |
587 | | - "label": "test-boolean", |
588 | | - "schema": { |
589 | | - "type": "Boolean", |
590 | | - "defaultValue": true, |
591 | | - "isValueRequired": true |
592 | | - } |
593 | | - }""" |
594 | | - ) |
| 587 | + "name": "test-boolean", |
| 588 | + "label": "test-boolean", |
| 589 | + "schema": { |
| 590 | + "type": "Boolean", |
| 591 | + "defaultValue": true, |
| 592 | + "isValueRequired": true |
| 593 | + } |
| 594 | + }""" |
| 595 | + )) |
595 | 596 | self.assertEqual( |
596 | 597 | camel_dict_to_snake_dict(mock_response_metadata), |
597 | 598 | resp.response_metadata.__dict__, |
@@ -654,17 +655,18 @@ def test_create_custom_metadata_fields_succeeds_with_type_single_select(self): |
654 | 655 | }, |
655 | 656 | } |
656 | 657 |
|
657 | | - request_body = make_string_to_single_line( |
658 | | - """{"name": "test", |
659 | | - "label": "test", |
660 | | - "schema": |
661 | | - { |
662 | | - "type": "SingleSelect", |
663 | | - "selectOptions": ["small", "medium", "large", 30, 40, |
664 | | - true] |
665 | | - } |
666 | | - }""" |
667 | | - ) |
| 658 | + request_body = json.dumps(json.loads( |
| 659 | + """{ |
| 660 | + "name": "test", |
| 661 | + "label": "test", |
| 662 | + "schema": |
| 663 | + { |
| 664 | + "type": "SingleSelect", |
| 665 | + "selectOptions": ["small", "medium", "large", 30, 40, |
| 666 | + true] |
| 667 | + } |
| 668 | + }""" |
| 669 | + )) |
668 | 670 | self.assertEqual( |
669 | 671 | camel_dict_to_snake_dict(mock_response_metadata), |
670 | 672 | resp.response_metadata.__dict__, |
@@ -733,18 +735,18 @@ def test_create_custom_metadata_fields_succeeds_with_type_multi_select(self): |
733 | 735 | }, |
734 | 736 | } |
735 | 737 |
|
736 | | - request_body = make_string_to_single_line( |
| 738 | + request_body = json.dumps(json.loads( |
737 | 739 | """{ |
738 | | - "name": "test", |
739 | | - "label": "test", |
740 | | - "schema": { |
741 | | - "type": "MultiSelect", |
742 | | - "selectOptions": ["small", "medium", "large", 30, 40, true], |
743 | | - "defaultValue": ["small", 30, true], |
744 | | - "isValueRequired": true |
745 | | - } |
746 | | - }""" |
747 | | - ) |
| 740 | + "name": "test", |
| 741 | + "label": "test", |
| 742 | + "schema": { |
| 743 | + "type": "MultiSelect", |
| 744 | + "selectOptions": ["small", "medium", "large", 30, 40, true], |
| 745 | + "defaultValue": ["small", 30, true], |
| 746 | + "isValueRequired": true |
| 747 | + } |
| 748 | + }""" |
| 749 | + )) |
748 | 750 | self.assertEqual( |
749 | 751 | camel_dict_to_snake_dict(mock_response_metadata), |
750 | 752 | resp.response_metadata.__dict__, |
@@ -802,15 +804,15 @@ def test_update_custom_metadata_fields_succeeds(self): |
802 | 804 | }, |
803 | 805 | } |
804 | 806 |
|
805 | | - request_body = make_string_to_single_line( |
| 807 | + request_body = json.dumps(json.loads( |
806 | 808 | """{ |
807 | | - "label": "test-update", |
808 | | - "schema": { |
809 | | - "minValue": 100, |
810 | | - "maxValue": 200 |
811 | | - } |
812 | | - }""" |
813 | | - ) |
| 809 | + "label": "test-update", |
| 810 | + "schema": { |
| 811 | + "minValue": 100, |
| 812 | + "maxValue": 200 |
| 813 | + } |
| 814 | + }""" |
| 815 | + )) |
814 | 816 |
|
815 | 817 | self.assertEqual( |
816 | 818 | camel_dict_to_snake_dict(mock_response_metadata), |
|
0 commit comments