def test_permissions_for_backlog_workflow(self, mock_get_current_user): # noqa # pylint: disable=invalid-name """Tests whether the creator has all the necessary permissions for backlog workflow.""" my_person = Person(name="kekec", email="*****@*****.**") creator_role = Role.query.filter(Role.name == "Creator").one() user_role = UserRole(role=creator_role, person=my_person) # noqa # pylint: disable=unused-variable mock_get_current_user.return_value = Person(name="Mojca", email="*****@*****.**") backlog_workflow = db.session\ .query(Workflow)\ .filter(Workflow.kind == "Backlog").one() workflow_ctx = backlog_workflow.context.id user_perms = load_permissions_for(my_person) actions = ["read", "edit", "update"] _types = ["Workflow", "Cycle", "CycleTaskGroup", "CycleTaskGroupObjectTask", "TaskGroup"] for action in actions: for obj_type in _types: self.assertTrue(workflow_ctx in user_perms[action][obj_type]['contexts']) ctgot_ctxs = user_perms['delete']['CycleTaskGroupObjectTask']['contexts'] self.assertTrue(workflow_ctx in ctgot_ctxs)
def parse_item(self): """ emails are case insensitive """ email = self.raw_value.lower() if not email: self.add_error(errors.MISSING_VALUE_ERROR, column_name="Email") elif not Person.is_valid_email(email): self.add_error(errors.WRONG_VALUE_ERROR, column_name=self.display_name) return "" return email
def parse_item(self): """ emails are case insensitive """ email = self.raw_value.lower() if not email: self.add_error(errors.MISSING_VALUE_ERROR, column_name="Email") elif not Person.is_valid_email(email): self.add_error(errors.WRONG_VALUE_ERROR, column_name=self.display_name) return "" return email