def test_add_registration_data_400(self): payload = { "user_handle": user_handle, } response = User.addRegistrationData( app, RegistrationFields.EMAIL, payload, eth_private_key) self.assertEqual(response["status"], "FAILURE") response = User.addRegistrationData( app, RegistrationFields.PHONE, payload, eth_private_key) self.assertEqual(response["status"], "FAILURE") response = User.addRegistrationData( app, RegistrationFields.IDENTITY, payload, eth_private_key) self.assertEqual(response["status"], "FAILURE") response = User.addRegistrationData( app, RegistrationFields.ADDRESS, payload, eth_private_key) self.assertEqual(response["status"], "FAILURE")
def test_add_registration_data_200(self): email = "*****@*****.**" payload = { "user_handle": user_handle, "email": email, } response = User.addRegistrationData( app, RegistrationFields.EMAIL, payload, eth_private_key) self.assertTrue(response["success"]) self.assertIsNotNone(response["message"]) self.assertEqual(response["status"], "SUCCESS") self.assertEqual(response["email"]["email"], email) self.assertIsNotNone(response["email"]["added_epoch"]) self.assertIsNotNone(response["email"]["modified_epoch"]) self.assertIsNotNone(response["email"]["uuid"]) phone = "3189250987" payload = { "user_handle": user_handle, "phone": phone, "sms_opt_in": True } response = User.addRegistrationData( app, RegistrationFields.PHONE, payload, eth_private_key) self.assertTrue(response["success"]) self.assertIsNotNone(response["message"]) self.assertEqual(response["status"], "SUCCESS") self.assertEqual(response["phone"]["phone"], phone) self.assertIsNotNone(response["phone"]["added_epoch"]) self.assertIsNotNone(response["phone"]["modified_epoch"]) self.assertIsNotNone(response["phone"]["uuid"]) self.assertTrue(response.get('phone').get( 'sms_confirmation_requested')) payload = { "user_handle": business_handle } response = User.get_entity(app, payload, eth_private_key_3) identity_uuid = response["identities"][0]["uuid"] payload = { "user_handle": business_handle, "uuid": identity_uuid } response = User.deleteRegistrationData( app, RegistrationFields.IDENTITY, payload, eth_private_key_3) self.assertTrue(response["success"]) identity_alias = "EIN" identity_value = "543212222" payload = { "user_handle": business_handle, "identity_alias": identity_alias, "identity_value": identity_value } response = User.addRegistrationData( app, RegistrationFields.IDENTITY, payload, eth_private_key_3) self.assertTrue(response["success"]) self.assertIsNotNone(response["message"]) self.assertEqual(response["status"], "SUCCESS") self.assertEqual(response["identity"]["identity_type"], identity_alias) self.assertIsNotNone(response["identity"]["identity"]) self.assertIsNotNone(response["identity"]["added_epoch"]) self.assertIsNotNone(response["identity"]["modified_epoch"]) self.assertIsNotNone(response["identity"]["uuid"]) address_alias = "added address" street_address_1 = "324 Songbird Avenue" street_address_2 = "Apt. 132" state = "VA" postal_code = "12345" country = "US" city = "Portland" payload = { "user_handle": user_handle, "address_alias": address_alias, "street_address_1": street_address_1, "street_address_2": street_address_2, "city": city, "state": state, "postal_code": postal_code, "country": country } response = User.addRegistrationData( app, RegistrationFields.ADDRESS, payload, eth_private_key) self.assertTrue(response["success"]) self.assertIsNotNone(response["message"]) self.assertEqual(response["status"], "SUCCESS") self.assertEqual(response["address"]["nickname"], address_alias) self.assertEqual(response["address"] ["street_address_1"], street_address_1) self.assertEqual(response["address"] ["street_address_2"], street_address_2) self.assertEqual(response["address"]["city"], city) self.assertEqual(response["address"]["state"], state) self.assertEqual(response["address"]["postal_code"], postal_code) self.assertEqual(response["address"]["country"], country) self.assertIsNotNone(response["address"]["added_epoch"]) self.assertIsNotNone(response["address"]["modified_epoch"]) self.assertIsNotNone(response["address"]["uuid"]) payload = { 'user_handle': user_handle, 'device_fingerprint': 'test_device_fingerprint_added' } response = User.add_registration_data( app, RegistrationFields.DEVICE, payload, eth_private_key) self.assertTrue(response["success"]) self.assertIsNotNone(response["message"]) self.assertRegex(response.get('message'), r'\bsuccessfully registered for handle\b') self.assertEqual(response.get('status_code'), 200) self.assertEqual(response["status"], "SUCCESS")