def setUp(self): create_groups.Command().handle() self.user = get_user_model().objects.create(username="******") self.form = Form.objects.create(name="Hundiformular", description="Doggo", js_code="var foo;", xml_code="<xml></xml>", active=True) # create a group and add a form/user to it self.group = Group.objects.create(name="hundigruppe") self.user.groups.add(self.group) self.user.groups.add(AdministrativeStaffGroup) self.form.teams.add(self.group) self.keypair = generate_test_keypair() self.first_key = EncryptionKey.objects.create( public_key=self.keypair["publickey"], user=self.user, active=True) create_signature_key.Command().handle() self.form_submission = FormService.submit(form_id=self.form.id, content="helo") self.second_form = Form.objects.create(name="andre", description="andre", js_code="var foo;", xml_code="<xml></xml>", active=True) # create a group and add a form/user to it self.second_group = Group.objects.create(name="andre") self.second_form.teams.add(self.second_group) self.second_form_submission = FormService.submit( form_id=self.second_form.id, content="helloo")
def setUp(self): create_groups.Command().handle() self.user = get_user_model().objects.create(username="******") self.admin = get_user_model().objects.create(username="******") self.user.groups.add(AdministrativeStaffGroup) self.admin.groups.add(InstanceAdminGroup) self.form = Form.objects.create( name="Hundiformular", description="Doggo", js_code="var foo;", xml_code="<xml></xml>", active=True, ) # create a group and add a form/user to it self.group = TeamService.create(self.admin, "Hunditeam", {}) create_mock_cert(self.group) TeamMembershipService.add_member(self.admin, team_id=self.group.id, keys={}, invited_user_id=self.user.id) self.form.teams.add(self.group) self.keypair = generate_test_keypair() self.first_key = EncryptionKey.objects.create( public_key=self.keypair["publickey"], user=self.user, active=True) create_signature_key.Command().handle() self.form_submission = FormService.submit(form_id=self.form.id, content="helo")
def test_create_group_permissions(self): perm = Group.objects.filter(name=AuthorizedGroup.group_name) self.assertFalse(perm, 'The group should not exist yet, but it does.') create_groups.Command().handle() perm = Group.objects.filter(name=AuthorizedGroup.group_name) self.assertTrue(perm, 'The group should exist, but it doesnt.')
def test_invalid_default_group(self): settings.DEFAULT_GROUPS_MODULE = None with self.assertRaises(AttributeError) as e: create_groups.Command().handle() self.assertIn("DEFAULT_GROUPS_MODULE setting is not set!", str(e.exception)) # Restore DEFAULT_GROUPS_MODULE setting settings.DEFAULT_GROUPS_MODULE = 'test_app.groups'
def setUp(self): self.authorized_user = get_user_model().objects.create( username='******') self.unauthorized_user = get_user_model().objects.create( username='******') create_permissions.Command().handle() create_groups.Command().handle() self.authorized_user.groups.add(AuthorizedGroup) self.factory = RequestFactory()
def setUp(self): create_groups.Command().handle() self.user = get_user_model().objects.create(username="******") self.admin = get_user_model().objects.create(username="******") self.user.groups.add(AdministrativeStaffGroup) self.admin.groups.add(InstanceAdminGroup) self.form = Form.objects.create(name="Hundiformular", description="Doggo", js_code="var foo;", xml_code="<xml></xml>", active=True) # create a group and add a form/user to it self.group = Group.objects.create(name="hundigruppe") self.user.groups.add(self.group) self.form.teams.add(self.group)
def setUp(self): create_groups.Command().handle() self.user = get_user_model().objects.create(username="******") self.admin = get_user_model().objects.create(username="******") self.user.groups.add(AdministrativeStaffGroup) self.admin.groups.add(InstanceAdminGroup) self.form = Form.objects.create( name="Hundiformular", description="Doggo", js_code="var foo;", xml_code="<xml></xml>", active=True, ) # create a group and add a form/user to it self.group = TeamService.create(self.admin, "Hunditeam", {}) create_mock_cert(self.group) TeamMembershipService.add_member(self.admin, team_id=self.group.id, keys={}, invited_user_id=self.user.id) self.form.teams.add(self.group)
def setUp(self): create_groups.Command().handle() self.user = get_user_model().objects.create(username="******") self.admin = get_user_model().objects.create(username="******") self.user.groups.add(AdministrativeStaffGroup) self.admin.groups.add(InstanceAdminGroup)
def setUp(self): create_permissions.Command().handle() create_groups.Command().handle() self.test_user = get_user_model().objects.create_user( username="******", password="******" )