|
77 | 77 | "first_name": "Jane",
|
78 | 78 | "last_name": "Doe",
|
79 | 79 | "language": "en_US",
|
80 |
| - KIT_NAME_KEY: EXISTING_KIT_NAME |
| 80 | + KIT_NAME_KEY: EXISTING_KIT_NAME, |
| 81 | + "latitude": 32.8798916, |
| 82 | + "longitude": -117.2363115, |
| 83 | + "cannot_geocode": False |
81 | 84 | }
|
82 | 85 | DUMMY_ACCT_INFO_2 = {
|
83 | 86 | "address": {
|
|
91 | 94 | "first_name": "Obie",
|
92 | 95 | "last_name": "Dobie",
|
93 | 96 | "language": "en_US",
|
94 |
| - KIT_NAME_KEY: EXISTING_KIT_NAME_2 |
| 97 | + KIT_NAME_KEY: EXISTING_KIT_NAME_2, |
| 98 | + "latitude": 32.8798916, |
| 99 | + "longitude": -117.2363115, |
| 100 | + "cannot_geocode": False |
95 | 101 | }
|
96 | 102 | DUMMY_ACCT_ADMIN = {
|
97 | 103 | "address": {
|
|
104 | 110 | "email": TEST_EMAIL_3,
|
105 | 111 | "first_name": "Obie",
|
106 | 112 | "last_name": "Dobie",
|
107 |
| - KIT_NAME_KEY: EXISTING_KIT_NAME_2 |
| 113 | + KIT_NAME_KEY: EXISTING_KIT_NAME_2, |
| 114 | + "latitude": 32.8798916, |
| 115 | + "longitude": -117.2363115, |
| 116 | + "cannot_geocode": False |
108 | 117 | }
|
109 | 118 |
|
110 | 119 | SOURCE_ID_1 = "9fba75a5-6fbf-42be-9624-731b6a9a161a"
|
@@ -467,6 +476,9 @@ def _create_dummy_acct_from_t(t, create_dummy_1=True,
|
467 | 476 | input_obj['address']['post_code'],
|
468 | 477 | input_obj['address']['country_code']
|
469 | 478 | ),
|
| 479 | + input_obj['latitude'], |
| 480 | + input_obj['longitude'], |
| 481 | + input_obj['cannot_geocode'], |
470 | 482 | input_obj['kit_name'],
|
471 | 483 | input_obj['language']
|
472 | 484 | )
|
@@ -697,6 +709,16 @@ def validate_dummy_acct_response_body(self, response_obj,
|
697 | 709 | expected_dict[ACCT_TYPE_KEY] = ACCT_TYPE_VAL
|
698 | 710 | expected_dict[CREATION_TIME_KEY] = real_creation_time
|
699 | 711 | expected_dict[UPDATE_TIME_KEY] = real_update_time
|
| 712 | + |
| 713 | + # the lat, long, and cannot_geocode need to be ignored for the sake of |
| 714 | + # comparisons |
| 715 | + expected_dict.pop("latitude", None) |
| 716 | + expected_dict.pop("longitude", None) |
| 717 | + expected_dict.pop("cannot_geocode", None) |
| 718 | + response_obj.pop("latitude", None) |
| 719 | + response_obj.pop("longitude", None) |
| 720 | + response_obj.pop("cannot_geocode", None) |
| 721 | + |
700 | 722 | self.assertEqual(expected_dict, response_obj)
|
701 | 723 |
|
702 | 724 | return real_acct_id_from_body
|
@@ -740,11 +762,15 @@ def test_accounts_create_success(self):
|
740 | 762 |
|
741 | 763 | def test_accounts_create_fail_400_without_required_fields(self):
|
742 | 764 | """Return 400 validation fail if don't provide a required field """
|
| 765 | + input_obj = copy.deepcopy(DUMMY_ACCT_INFO) |
| 766 | + input_obj.pop('latitude', None) |
| 767 | + input_obj.pop('longitude', None) |
| 768 | + input_obj.pop('cannot_geocode', None) |
743 | 769 |
|
744 | 770 | self.run_query_and_content_required_field_test(
|
745 | 771 | "/api/accounts", "post",
|
746 | 772 | self.default_querystring_dict,
|
747 |
| - DUMMY_ACCT_INFO, |
| 773 | + input_obj, |
748 | 774 | skip_fields=["kit_name"])
|
749 | 775 |
|
750 | 776 | def test_accounts_create_fail_404(self):
|
@@ -926,7 +952,8 @@ def test_account_scrub_success(self):
|
926 | 952 | response_obj = json.loads(response.data)
|
927 | 953 |
|
928 | 954 | for k in DUMMY_ACCT_INFO:
|
929 |
| - if k in (KIT_NAME_KEY, 'language'): |
| 955 | + if k in (KIT_NAME_KEY, 'language', 'cannot_geocode', 'latitude', |
| 956 | + 'longitude'): |
930 | 957 | continue
|
931 | 958 | self.assertNotEqual(DUMMY_ACCT_INFO[k],
|
932 | 959 | response_obj[k])
|
@@ -1251,6 +1278,9 @@ def test_account_update_fail_400_without_required_fields(self):
|
1251 | 1278 |
|
1252 | 1279 | dummy_acct_id = create_dummy_acct()
|
1253 | 1280 | changed_acct_dict = self.make_updated_acct_dict()
|
| 1281 | + changed_acct_dict.pop('latitude', None) |
| 1282 | + changed_acct_dict.pop('longitude', None) |
| 1283 | + changed_acct_dict.pop('cannot_geocode', None) |
1254 | 1284 |
|
1255 | 1285 | input_url = "/api/accounts/{0}".format(dummy_acct_id)
|
1256 | 1286 | self.run_query_and_content_required_field_test(
|
|
0 commit comments