def setUp(self): workspace = Workspace.objects.create(name=u'lagat.com') u = User.objects.create_user(username=u'*****@*****.**', password=u'secret', first_name=u"Eugène", last_name=u"Mc Donéld") createUserProfile(u, workspace) c = Client() c.post('/i18n/setlang/', {'language': 'en'})
def generate_users(workspace, start_date, end_date, nb=10): parent_ids = [] extension = workspace.name.replace('-', '.') ceo_email = 'ceo@%s' % extension (ceo, created) = User.objects.get_or_create(username=ceo_email) ceo.email = ceo_email ceo.first_name = 'CEO' ceo.has_dashboard_access = True ceo.is_hr = True ceo.is_primary = True if created: ceo.password = make_password('test') createUserProfile(ceo, workspace) ceo.save() ceo.profile.has_dashboard_access = True ceo.profile.is_hr = True ceo.profile.is_primary = True ceo.profile.save() DailySalary.objects.create(workspace=workspace, profile=ceo.profile, daily_wage=random.randint(1500, 2000), start_date=start_date, end_date=end_date) for (i, j) in (('rd', 'R&D'), ('marketing', 'Marketing'), ('sales', 'Sales')): user = User.objects.create_user(username='******' % (i, extension), password='******', email='%s@%s' % (i, extension), first_name=j) profile = createUserProfile(user, workspace) profile.parent = ceo.profile profile.save() parent_ids.append(user.id) DailySalary.objects.create(workspace=workspace, profile=profile, daily_wage=random.randint(900, 1500), start_date=start_date, end_date=end_date) if nb > 4: for i in range(nb - 4): email = 'user%i@%s' % (i, extension) user = User.objects.create_user(username=email, password='******', email=email, first_name='user%i' % (i)) profile = createUserProfile(user, workspace) profile.parent = Profile.objects.get( user__id=random.choice(parent_ids)) profile.save() parent_ids.append(user.id) DailySalary.objects.create(workspace=workspace, profile=profile, daily_wage=random.randint(500, 1000), start_date=start_date, end_date=end_date)
def save(self): ws_name = getDashboardNameFromEmail(self.cleaned_data['email']) workspace = Workspace.objects.create(name=ws_name) newuser = super(SignupForm, self).save() profile = createUserProfile(newuser, workspace) profile.has_dashboard_access = True profile.is_hr = True profile.is_primary = True profile.save()
def setUp(self): workspace = Workspace.objects.create(name='testlagatclientapp') u = User.objects.create_user(username='******', password='******') ud = createUserProfile(u, workspace) p = Task.objects.create(workspace=workspace, name='p1', owner=ud) self.r = AutoRecord.objects.create(workspace=workspace, task=p, profile=ud, start=timezone.now())
def save(self): ws_name = getDashboardNameFromEmail(self.cleaned_data['email']) workspace = Workspace.objects.get(name=ws_name) newuser = super(ClientUserForm, self).save() createUserProfile(newuser, workspace)
def setUp(self): self.ws = Workspace.objects.create(name='testws') u = User.objects.create_user(username='******', password='******') self.p = createUserProfile(u, self.ws)
def setUp(self): workspace = Workspace.objects.create(name='testlagatclientapp') u = User.objects.create_user(username='******', password='******') self.p = createUserProfile(u, workspace)