Beispiel #1
0
    def register_companies(self, count = 10, verified = True):
        companies = []
        for a in xrange(count):
            user = User.create_user('*****@*****.**' % a, User.make_random_password())
            if not user:
                raise Exception('failed to create test user')
            User.collection.update({'_id' : user._id}, {'$set' : {'activated' : True}})

            employee = CompanyEmployee({'user_id' : user._id,
                                        'first_name' : 'test_user_' + str(a)})
            employee.save()
            company = Company({'rek_id' : integer_to_code(a + 10000),
                'owner_employee_id' : employee._id,
                'short_name' : 'tc_' + str(a),
                'full_name' : 'OOO Test Company ' + str(a),
                'brand_name' : 'Test Company Brand ' + str(a),
                'description' : 'Test company ' + str(a),
                'category_text' : 'Testing',
                'staff_size' : (a + 1) * 3,
                'inn' : int(str(a + 1) + '0' * (12 - len(str(a)))) + a + 1,
                'kpp' : int(str(a + 1) + '1' * (9 - len(str(a)))) + a + 1,
                'is_account_activated' : True,
                'account_status' : CompanyAccountStatus.VERIFIED if verified else CompanyAccountStatus.JUST_REGISTERED
            })
            company.save()
            employee.set(company_id = company._id)
            companies.append(company)

        return companies
Beispiel #2
0
    def register_companies(self, count=10, verified=True):
        companies = []
        for a in xrange(count):
            user = User.create_user('*****@*****.**' % a,
                                    User.make_random_password())
            if not user:
                raise Exception('failed to create test user')
            User.collection.update({'_id': user._id},
                                   {'$set': {
                                       'activated': True
                                   }})

            employee = CompanyEmployee({
                'user_id': user._id,
                'first_name': 'test_user_' + str(a)
            })
            employee.save()
            company = Company({
                'rek_id':
                integer_to_code(a + 10000),
                'owner_employee_id':
                employee._id,
                'short_name':
                'tc_' + str(a),
                'full_name':
                'OOO Test Company ' + str(a),
                'brand_name':
                'Test Company Brand ' + str(a),
                'description':
                'Test company ' + str(a),
                'category_text':
                'Testing',
                'staff_size': (a + 1) * 3,
                'inn':
                int(str(a + 1) + '0' * (12 - len(str(a)))) + a + 1,
                'kpp':
                int(str(a + 1) + '1' * (9 - len(str(a)))) + a + 1,
                'is_account_activated':
                True,
                'account_status':
                CompanyAccountStatus.VERIFIED
                if verified else CompanyAccountStatus.JUST_REGISTERED
            })
            company.save()
            employee.set(company_id=company._id)
            companies.append(company)

        return companies
Beispiel #3
0
def create_staff_user(email):
    password = User.make_random_password()
    created_user = User.create_user(email, password)
    created_user.save()

    return created_user, password
Beispiel #4
0
def create_staff_user(email):
    password = User.make_random_password()
    created_user = User.create_user(email, password)
    created_user.save()

    return created_user, password