Пример #1
0
    def test_create_user_member(self):
        """
        Test following 3 methods
        - camunda_api.TenantApi.create_user_member
        - camunda_api.TenantApi.get_list
        - camunda_api.UserApi.get_list
        """
        tenant = Tenant()
        tenant.name = 'test_create_user_member_tenant_name'

        user = User()
        user.email = '*****@*****.**'
        user.first_name = 'test_create_user_member_first_name'
        user.last_name = 'test_create_user_member_last_name'
        user.tenant = tenant

        UserApi.create_user(self.session, user)
        TenantApi.create(self.session, tenant)
        TenantApi.create_user_member(self.session, user)

        tenant_list = TenantApi.get_list(self.session,
                                         userMember=user.email).json()
        user_list = UserApi.get_list(self.session,
                                     memberOfTenant=tenant.name).json()

        self.assertEqual(tenant.name, tenant_list[0]['id'])
        self.assertEqual(tenant.name, tenant_list[0]['name'])
        self.assertEqual(user.email, user_list[0]['id'])
        self.assertEqual(user.first_name, user_list[0]['firstName'])
        self.assertEqual(user.last_name, user_list[0]['lastName'])
        self.assertEqual(user.email, user_list[0]['email'])

        UserApi.delete(self.session, user)
        TenantApi.delete(self.session, tenant)
Пример #2
0
    def test_user_confirmed_callback(self):
        tenant = Tenant()
        tenant.name = 'test_tenant_name_SignalCallbacksTestCase'

        user = User()
        user.email = '*****@*****.**'
        user.first_name = 'test_first_name_SignalCallbacksTestCase'
        user.last_name = 'test_last_name_SignalCallbacksTestCase'
        user.tenant = tenant

        user_confirmed_callback(self.app, user)

        response_json = UserApi.get_one(self.session, user).json()
        self.assertEqual(response_json['id'], user.email)
        self.assertEqual(response_json['firstName'], user.first_name)
        self.assertEqual(response_json['lastName'], user.last_name)
        self.assertEqual(response_json['email'], user.email)

        response_json = TenantApi.get_one(self.session, user.tenant).json()
        self.assertEqual(response_json['id'], user.tenant.name)
        self.assertEqual(response_json['name'], user.tenant.name)

        UserApi.delete(self.session, user)
        TenantApi.delete(self.session, tenant)