def setUp(self): """ Setup fixtures before running e2e test. """ super(AuthorizationTestCase, self).setUp() call_command('index') LilyUserFactory.create(is_active=True, email='*****@*****.**', password=make_password('testing'))
def setUp(self): """ Setup fixtures before running e2e test. """ super(AuthorizationTestCase, self).setUp() call_command("index") call_command("testdata", target="contacts_and_accounts,cases,deals,notes") LilyUserFactory.create(is_active=True, email="*****@*****.**", password=make_password("testing"))
def users_login(self, **kwargs): kwargs.update({ 'tenant': kwargs.get('tenant', self.tenant), 'teams': kwargs.get('teams') if kwargs.get('teams') else iterator(self.users_team), 'is_active': kwargs.get('is_active', True), 'email': '*****@*****.**' % self.tenant.pk, }) user = LilyUserFactory.create(**kwargs) self.stdout.write('\nYou can now login as a normal user in %(tenant)s with:\n%(email)s\n%(password)s\n' % { 'tenant': self.tenant, 'email': user.email, 'password': '******' }) kwargs['email'] = '*****@*****.**' % self.tenant.pk superuser = LilySuperUserFactory.create(**kwargs) self.stdout.write('\nYou can now login as a superuser in %(tenant)s with:\n%(email)s\n%(password)s\n\n' % { 'tenant': self.tenant, 'email': superuser.email, 'password': '******' }) return [user, superuser]
def users_login(self, **kwargs): kwargs.update( { "tenant": kwargs.get("tenant", self.tenant), "teams": kwargs.get("teams") if kwargs.get("teams") else iterator(self.users_team), "is_active": kwargs.get("is_active", True), "email": "*****@*****.**" % self.tenant.pk, } ) user = LilyUserFactory.create(**kwargs) self.stdout.write( "\nYou can now login as a normal user in %(tenant)s with:\n%(email)s\n%(password)s\n" % {"tenant": self.tenant, "email": user.email, "password": "******"} ) kwargs["email"] = "*****@*****.**" % self.tenant.pk superuser = LilySuperUserFactory.create(**kwargs) self.stdout.write( "\nYou can now login as a superuser in %(tenant)s with:\n%(email)s\n%(password)s\n\n" % {"tenant": self.tenant, "email": superuser.email, "password": "******"} ) return [user, superuser]
def users(self, size, tenant): LilyUserFactory.create_batch(size, tenant=tenant) user = LilyUserFactory.create(tenant=tenant, is_active=True, email='*****@*****.**' % tenant.pk) self.stdout.write('You can now login as a normal user in %(tenant)s with:\n%(email)s\n%(password)s\n' % { 'tenant': tenant, 'email': user.email, 'password': '******' })
def setUpClass(cls): """ Creates a user and logs it in before running the account tests. """ # Remove leftovers from previous tests LilyUser.objects.all().delete() cls.user = LilyUserFactory.create(is_active=True, email='*****@*****.**', password=make_password('test')) cls.client = APIClient() cls.client.login(email='*****@*****.**', password='******')
def users(self, size, tenant): LilyUserFactory.create_batch(size, tenant=tenant) user = LilyUserFactory.create(tenant=tenant, is_active=True, email='*****@*****.**' % tenant.pk) self.stdout.write( 'You can now login as a normal user in %(tenant)s with:\n%(email)s\n%(password)s\n' % { 'tenant': tenant, 'email': user.email, 'password': '******' })
def test_contact_closed_deals_cases_account(self): """ Test having a contact attached to a contact with no cases or deals. """ assigned_to_user = LilyUserFactory.create(tenant=self.user_obj.tenant, is_active=True) account = AccountFactory.create(tenant=self.user_obj.tenant, assigned_to=assigned_to_user) Function.objects.create(account=account, contact=self.contact) # Make api call. response = self.user.get(reverse(self.search_url, kwargs={'number': self.phone_number.number})) # Verify response. self._verify_response(response, assigned_to_user)
def test_contact_closed_deals_cases_account(self): """ Test having a contact attached to a contact with no cases or deals. """ assigned_to_user = LilyUserFactory.create(tenant=self.user_obj.tenant, is_active=True) account = AccountFactory.create(tenant=self.user_obj.tenant, assigned_to=assigned_to_user) Function.objects.create(account=account, contact=self.contact) # Make api call. response = self.user.get( reverse(self.search_url, kwargs={'number': self.phone_number.number})) # Verify response. self._verify_response(response, assigned_to_user)