def test_api__get_content_types__ok_200__nominal_case(self): """ Get system content_types list with a registered user. """ self.testapp.authorization = ("Basic", ("*****@*****.**", "*****@*****.**")) res = self.testapp.get("/api/v2/system/content_types", status=200) res = res.json_body assert len(res) == len(content_type_list.endpoint_allowed_types_slug()) content_types = content_type_list.endpoint_allowed_types_slug() for counter, content_type_slug in enumerate(content_types): content_type = content_type_list.get_one_by_slug(content_type_slug) assert res[counter]["slug"] == content_type.slug assert res[counter]["fa_icon"] == content_type.fa_icon assert res[counter]["hexcolor"] == content_type.hexcolor assert res[counter]["label"] == content_type.label assert res[counter][ "creation_label"] == content_type.creation_label for status_counter, status in enumerate( content_type.available_statuses): assert (res[counter]["available_statuses"][status_counter] ["fa_icon"] == status.fa_icon) assert (res[counter]["available_statuses"][status_counter] ["global_status"] == status.global_status) assert res[counter]["available_statuses"][status_counter][ "slug"] == status.slug assert (res[counter]["available_statuses"][status_counter] ["hexcolor"] == status.hexcolor)
def test_api__get_content_types__ok_200__nominal_case(self): """ Get system content_types list with a registered user. """ self.testapp.authorization = ('Basic', ('*****@*****.**', '*****@*****.**')) res = self.testapp.get('/api/v2/system/content_types', status=200) res = res.json_body assert len(res) == len(content_type_list.endpoint_allowed_types_slug()) content_types = content_type_list.endpoint_allowed_types_slug() for counter, content_type_slug in enumerate(content_types): content_type = content_type_list.get_one_by_slug(content_type_slug) assert res[counter]['slug'] == content_type.slug assert res[counter]['fa_icon'] == content_type.fa_icon assert res[counter]['hexcolor'] == content_type.hexcolor assert res[counter]['label'] == content_type.label assert res[counter][ 'creation_label'] == content_type.creation_label for status_counter, status in enumerate( content_type.available_statuses): assert res[counter]['available_statuses'][status_counter][ 'fa_icon'] == status.fa_icon # nopep8 assert res[counter]['available_statuses'][status_counter][ 'global_status'] == status.global_status # nopep8 assert res[counter]['available_statuses'][status_counter][ 'slug'] == status.slug # nopep8 assert res[counter]['available_statuses'][status_counter][ 'hexcolor'] == status.hexcolor # nopep8
def test_api__get_content_types__ok_200__nominal_case(self): """ Get system content_types list with a registered user. """ self.testapp.authorization = ( 'Basic', ( '*****@*****.**', '*****@*****.**' ) ) res = self.testapp.get('/api/v2/system/content_types', status=200) res = res.json_body assert len(res) == len(content_type_list.endpoint_allowed_types_slug()) content_types = content_type_list.endpoint_allowed_types_slug() for counter, content_type_slug in enumerate(content_types): content_type = content_type_list.get_one_by_slug(content_type_slug) assert res[counter]['slug'] == content_type.slug assert res[counter]['fa_icon'] == content_type.fa_icon assert res[counter]['hexcolor'] == content_type.hexcolor assert res[counter]['label'] == content_type.label assert res[counter]['creation_label'] == content_type.creation_label for status_counter, status in enumerate(content_type.available_statuses): assert res[counter]['available_statuses'][status_counter]['fa_icon'] == status.fa_icon # nopep8 assert res[counter]['available_statuses'][status_counter]['global_status'] == status.global_status # nopep8 assert res[counter]['available_statuses'][status_counter]['slug'] == status.slug # nopep8 assert res[counter]['available_statuses'][status_counter]['hexcolor'] == status.hexcolor # nopep8
def content_types(self, context, request: TracimRequest, hapic_data=None): """ Get list of alls content types availables in this tracim instance. """ content_types_slugs = content_type_list.endpoint_allowed_types_slug() content_types = [content_type_list.get_one_by_slug(slug) for slug in content_types_slugs] return content_types
def content_types(self, context, request: TracimRequest, hapic_data=None): """ Get list of alls content types availables in this tracim instance. """ content_types_slugs = content_type_list.endpoint_allowed_types_slug() content_types = [ content_type_list.get_one_by_slug(slug) for slug in content_types_slugs ] return content_types
def content_types(self, context, request: TracimRequest, hapic_data=None): """ Get list of alls content types availables in this tracim instance. """ app_config = request.registry.settings["CFG"] # type: CFG content_types_slugs = content_type_list.endpoint_allowed_types_slug() content_types = [content_type_list.get_one_by_slug(slug) for slug in content_types_slugs] content_types_in_context = [ content_type_list.get_content_type_in_context(content_type, app_config) for content_type in content_types ] return content_types_in_context
def update_validators(): all_content_types_validator.choices = content_type_list.endpoint_allowed_types_slug( ) # nopep8
def update_validators(): all_content_types_validator.choices = content_type_list.endpoint_allowed_types_slug() # nopep8