def create_empty(cls): """Create blank Control object.""" empty_control = ControlEntity() empty_control.type = cls.obj_control empty_control.custom_attributes = {None: None} empty_control.access_control_list = [] return empty_control
def _create_random_control(cls): """Create Control entity with randomly and predictably filled fields.""" random_control = ControlEntity() random_control.type = cls.obj_control random_control.title = cls.generate_string(cls.obj_control) random_control.slug = cls.generate_slug() random_control.status = unicode(element.ObjectStates.DRAFT) random_control.contact = cls.default_person.__dict__ random_control.owners = [cls.default_person.__dict__] random_control.access_control_list = [ ObjectPersonsFactory().get_acl_member( roles.CONTROL_ADMIN_ID, random_control.owners[0]), ObjectPersonsFactory().get_acl_member( roles.CONTROL_PRIMARY_CONTACT_ID, random_control.contact)] random_control.os_state = unicode(element.ReviewStates.UNREVIEWED) return random_control
def _create_random_control(cls): """Create Control entity with randomly and predictably filled fields.""" random_control = ControlEntity() random_control.type = cls.obj_control random_control.title = cls.generate_string(cls.obj_control) random_control.slug = cls.generate_slug() random_control.status = unicode(element.ObjectStates.DRAFT) random_control.contact = ObjectPersonsFactory().default().__dict__ random_control.owners = [ObjectPersonsFactory().default().__dict__] return random_control