Exemple #1
0
    def test_update_registration_data_400(self):
        payload = {
            "user_handle": user_handle,
        }

        response = User.updateRegistrationData(
            app, RegistrationFields.EMAIL, payload, eth_private_key)
        self.assertEqual(response["status"], "FAILURE")

        response = User.updateRegistrationData(
            app, RegistrationFields.PHONE, payload, eth_private_key)
        self.assertEqual(response["status"], "FAILURE")

        response = User.updateRegistrationData(
            app, RegistrationFields.IDENTITY, payload, eth_private_key)
        self.assertEqual(response["status"], "FAILURE")

        response = User.updateRegistrationData(
            app, RegistrationFields.ADDRESS, payload, eth_private_key)
        self.assertEqual(response["status"], "FAILURE")
Exemple #2
0
    def test_update_registration_data_200(self):
        payload = {
            "user_handle": user_handle
        }

        response = User.get_entity(app, payload, eth_private_key)

        email_uuid = response["emails"][0]["uuid"]
        phone_uuid = response["phones"][0]["uuid"]
        identity_uuid = response["identities"][0]["uuid"]
        address_uuid = response["addresses"][0]["uuid"]

        email = "*****@*****.**"
        payload = {
            "user_handle": user_handle,
            "email": email,
            "uuid": email_uuid
        }

        response = User.updateRegistrationData(
            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.assertEqual(response["email"]["uuid"], email_uuid)
        self.assertIsNotNone(response["email"]["added_epoch"])
        self.assertIsNotNone(response["email"]["modified_epoch"])

        phone = "3189250988"
        payload = {
            "user_handle": user_handle,
            "phone": phone,
            "uuid": phone_uuid,
            'sms_opt_in': False
        }

        response = User.update_registration_data(
            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"])

        identity_alias = "SSN"
        identity_value = "543212223"
        payload = {
            "user_handle": user_handle,
            "identity_alias": identity_alias,
            "identity_value": identity_value,
            "uuid": identity_uuid
        }

        response = User.updateRegistrationData(
            app, RegistrationFields.IDENTITY, payload, eth_private_key)
        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,
            "uuid": address_uuid
        }

        response = User.updateRegistrationData(
            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"])

        first_name = "NewFirst"
        last_name = "NewLast"
        entity_name = "NewFirst NewLast"
        birthdate = "1994-01-01"

        payload = {
            "user_handle": user_handle,
            "first_name": first_name,
            "last_name": last_name,
            "entity_name": entity_name,
            "birthdate": birthdate
        }

        response = User.updateRegistrationData(
            app, RegistrationFields.ENTITY, payload, eth_private_key)

        self.assertTrue(response["success"])
        self.assertIsNotNone(response["message"])
        self.assertEqual(response["status"], "SUCCESS")
        self.assertEqual(response["user_handle"], user_handle)
        self.assertEqual(response["entity_type"], "individual")
        self.assertEqual(response["entity"]["entity_name"], entity_name)
        self.assertEqual(response["entity"]["birthdate"], birthdate)
        self.assertEqual(response["entity"]["first_name"], first_name)
        self.assertEqual(response["entity"]["last_name"], last_name)
        self.assertIsNotNone(response["entity"]["created_epoch"])

        entity_name = "NewCompany"
        birthdate = "1994-01-01"
        business_type = "corporation"
        naics_code = 721
        doing_business_as = "NC Limited"
        business_website = "https://newwebsite.domain"

        payload = {
            "user_handle": business_handle,
            "entity_name": entity_name,
            "birthdate": birthdate,
            "business_type": business_type,
            "naics_code": naics_code,
            "doing_business_as": doing_business_as,
            "business_website": business_website
        }

        response = User.updateRegistrationData(
            app, RegistrationFields.ENTITY, payload, eth_private_key_3)

        self.assertTrue(response["success"])
        self.assertIsNotNone(response["message"])
        self.assertEqual(response["status"], "SUCCESS")
        self.assertEqual(response["user_handle"], business_handle)
        self.assertEqual(response["entity_type"], "business")
        self.assertEqual(response["entity"]["entity_name"], entity_name)
        self.assertEqual(response["entity"]["birthdate"], birthdate)
        self.assertEqual(response["entity"]["business_type"], business_type)
        self.assertEqual(response["entity"]["naics_code"], naics_code)
        self.assertEqual(response["entity"]
                         ["doing_business_as"], doing_business_as)
        self.assertEqual(response["entity"]
                         ["business_website"], business_website)
        self.assertIsNotNone(response["entity"]["created_epoch"])
        self.assertIsNotNone(response["entity"]["business_uuid"])
        self.assertIsNotNone(response["entity"]["naics_category"])
        self.assertIsNotNone(response["entity"]["naics_subcategory"])