Beispiel #1
0
 def test_create_with_add_base_doc(self):
     base_doc = User.build_base_doc(**user_base_doc)
     user_create_args['base_doc'] = base_doc
     user = User.create(self.client, **user_create_args)
     self.assertEqual(self.client, user.client)
     print(user.base_documents)
     self.assertEqual(len(user.base_documents), 1)
 def test_all(self):
     users = User.all(self.client)
     self.assertIsInstance(users, list)
     self.assertIsInstance(users[0], User)
     self.assertIsInstance(users[0].client, Client)
     # no duplicate clients on different users
     self.assertNotEqual(users[0].client, users[1].client)
     # with params
     query = "test"
     per_page = 5
     page1 = User.all(self.client, query=query, page=1, per_page=per_page)
     page2 = User.all(self.client, query=query, page=2, per_page=per_page)
     self.assertNotEqual(page1[0].id, page2[0].id)
     self.assertEqual(per_page, len(page1))
 def test_add_base_document(self):
     user = User.create(self.client, **user_create_args)
     self.assertFalse(user.base_documents)
     self.assertEqual('UNVERIFIED', user.permission)
     args = {
         'email': '*****@*****.**',
         'phone_number': '707-555-5555',
         'ip': '127.0.0.1',
         'name': 'Doctor BaseDoc',
         'alias': 'Basey',
         'entity_type': 'F',
         'entity_scope': 'Arts & Entertainment',
         'day': 28,
         'month': 2,
         'year': 1990,
         'address_street': '42 Base Blvd',
         'address_city': 'San Francisco',
         'address_subdivision': 'CA',
         'address_postal_code': '94114',
         'address_country_code': 'US'
     }
     base_document = user.add_base_document(**args)
     user = base_document.user
     self.assertEqual(1, len(user.base_documents))
     self.assertIsInstance(user.base_documents[0], BaseDocument)
     self.assertEqual(user.base_documents[0], base_document)
     self.assertEqual(user, base_document.user)
     properties = ['id', 'user', 'name', 'permission_scope',
                   'physical_documents', 'social_documents',
                   'virtual_documents']
     for prop in properties:
         self.assertIsNotNone(getattr(base_document, prop))
Beispiel #4
0
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.create(self.client, **user_create_args)
     self.nodes = AchUsNode.create_via_bank_login(self.user, 'fake',
                                                  'synapse_nomfa',
                                                  'test1234')
     self.from_node = self.nodes[0]
     self.to_node = self.nodes[1]
 def test_create(self):
     user = User.create(self.client, **user_create_args)
     properties = ['client', 'id', 'refresh_token', 'logins',
                   'phone_numbers', 'legal_names', 'permission',
                   'supp_id', 'is_business', 'cip_tag']
     self.assertEqual(self.client, user.client)
     # check properties assigned
     for prop in properties:
         self.assertIsNotNone(getattr(user, prop))
 def test_add_and_remove_legal_name(self):
     user = User.create(self.client, **user_create_args)
     new_name = "Barb Holland"
     self.assertNotIn(new_name, user.legal_names)
     # add legal name
     user = user.add_legal_name(new_name)
     self.assertIn(new_name, user.legal_names)
     # remove legal name
     user = user.remove_legal_name(new_name)
     self.assertNotIn(new_name, user.legal_names)
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.create(self.client, **user_create_args)
     self.nodes = AchUsNode.create_via_bank_login(self.user,
                                                  'bofa',
                                                  'synapse_nomfa',
                                                  'test1234')
     self.from_node = self.nodes[0]
     self.to_node = self.nodes[1]
 def test_add_and_remove_phone_number(self):
     user = User.create(self.client, **user_create_args)
     phone_number = '4155555555'
     # add phone number
     user = user.add_phone_number(phone_number)
     self.assertEqual(2, len(user.phone_numbers))
     self.assertIn(phone_number, user.phone_numbers)
     # remove phone number
     user = user.remove_phone_number(phone_number)
     self.assertNotIn(phone_number, user.phone_numbers)
 def test_add_and_remove_login(self):
     user = User.create(self.client, **user_create_args)
     email = '*****@*****.**'
     # add login
     user = user.add_login(email, password='******', read_only=True)
     self.assertEqual(email, user.logins[-1]['email'])
     self.assertEqual('READ', user.logins[-1]['scope'])
     # remove login
     user = user.remove_login(email)
     # TODO: update to loop through logins and check each dict for email
     self.assertEqual(1, len(user.logins))
    def test_fingerprint_registration(self):
        user = User.create(self.client, **user_create_args)

        devices = user.register_fingerprint('static_pin')
        self.assertIsInstance(devices, list)
        self.assertGreater(len(devices), 0)

        confirmation = user.select_2fa_device(devices[0])
        self.assertTrue(confirmation)

        confirmation = user.confirm_2fa_pin(device=devices[0], pin='123456')
        self.assertTrue(confirmation)
    def test_create_interchange_us_node(self):
        user = User.create(self.client, **user_create_args)
        # args = {
        #     "email":"*****@*****.**",
        #     "phone_number":"901.111.1111",
        #     "ip":"::1",
        #     "name":"FirstName LastName",
        #     "alias":"Test",
        #     "entity_type":"M",
        #     "entity_scope":"Arts & Entertainment",
        #     "day":2,
        #     "month":5,
        #     "year":1989,
        #     "address_street":"1 Market St.",
        #     "address_city":"SF",
        #     "address_subdivision":"CA",
        #     "address_postal_code":"94114",
        #     "address_country_code":"US"
        #     }
        base_document = user.add_base_document(**base_doc_args)
        doc_id = base_document.id
        time.sleep(5)
        kwargs = {
            'nickname': 'Python Test INTERCHANGE-US Account',
            'card_number':
            'nNKBubGyeL+31Hhgim89lIvfezPdfe8hLQxvm9H2wfpI2PxHk6yqvdh0jKwhib74LHBemAI5sRyr/5LmnYOeJoUU5TmkBtpvhxDTAtoCrim7+3KGatDwq1Z6NzV+S46fu+hp2h5DxUx6Os3PPalwz06qgbTG1yIkEvFi23D1FJGj2RM5BwYuy+dASktSoSHejj4+idiG8Sc48rKzOJXkRHSA/GIhyGeL0/GscTqAwiXaA9f9QjW74T0Ux/LRjXqVVK1wmT2M/UHLV/rheVCNZPw9Xq/VPoO3Jb/VbezsSvPwaHEV9M+utmUyn/jPru4vQpX7WM133Zx7OerGsyr/Zg==',
            'exp_date':
            'ctA4Zj1CP0WCiMefPYsyewVbIHNilfwA09X9NSCyWxft4WGwFZmZkhsBJh51QL751/iFkUHbd09ZpDYjS86PqyNPZ5LkBueGHDIghLwWyzH1l99RiIs8urOW9c4g3L1USD+kzzRAqG1DBkW47FAX6AhPSi3YgQd94ery1H+asaqDrP79ayzoJ+nRXeEqe83FIgNUk/J5+EcAz3JYnoBmp1sfz7a4zHkvk0eKCxQWLETdqvONyCZyXdC/4CkaCxJ/87VsN3i4+ToULtSluRv8xr1NpRhzipKiEKTYW1nvNDAaJQezTVP/+GxmTmQfnfpVNDpJbXjNrOTej1HgMFpg4w==',
            'document_id': str(doc_id)
        }
        node = InterchangeUsNode.create(user, **kwargs)
        self.assertIsInstance(node, InterchangeUsNode)
        self.assertEqual(user.id, node.user.id)

        other_props = [
            'nickname', 'id', 'type', 'is_active', 'network',
            'interchange_type', 'document_id', 'card_hash', 'is_international'
        ]
        for prop in other_props:
            self.assertIsNotNone(getattr(node, prop))
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.create(self.client, **user_create_args)
     args = {
         'email': '*****@*****.**',
         'phone_number': '707-555-5555',
         'ip': '127.0.0.1',
         'name': 'Doctor BaseDoc',
         'alias': 'Basey',
         'entity_type': 'F',
         'entity_scope': 'Arts & Entertainment',
         'birth_day': 28,
         'birth_month': 2,
         'birth_year': 1990,
         'address_street': '42 Base Blvd',
         'address_city': 'San Francisco',
         'address_subdivision': 'CA',
         'address_postal_code': '94114',
         'address_country_code': 'US'
     }
     self.base_document = self.user.add_base_document(**args)
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.create(self.client, **user_create_args)
     args = {
         'email': '*****@*****.**',
         'phone_number': '707-555-5555',
         'ip': '127.0.0.1',
         'name': 'Doctor BaseDoc',
         'alias': 'Basey',
         'entity_type': 'F',
         'entity_scope': 'Arts & Entertainment',
         'day': 28,
         'month': 2,
         'year': 1990,
         'address_street': '42 Base Blvd',
         'address_city': 'San Francisco',
         'address_subdivision': 'CA',
         'address_postal_code': '94114',
         'address_country_code': 'US'
     }
     self.base_document = self.user.add_base_document(**args)
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.create(self.client, **user_create_args)
     self.node = SynapseUsNode.create(self.user, 'Python Test SYNAPSE-US Node')
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.create(self.client, **user_create_args)
 def test_update_cip_tag(self):
     user = User.create(self.client, **user_create_args)
     self.assertEqual(1, user.cip_tag)
     new_cip = 3
     user = user.change_cip_tag(new_cip)
     self.assertEqual(new_cip, user.cip_tag)
 def setUp(self):
     print('\n{0}.{1}'.format(type(self).__name__, self._testMethodName))
     self.client = test_client
     self.user = User.by_id(self.client, 'INPUT_USER_ID_HERE')
 def test_by_id(self):
     user_id = User.create(self.client, **user_create_args).id
     user = User.by_id(self.client, user_id)
     self.assertIsInstance(user, User)
     self.assertEqual(user_id, user.id)