def control_tagrestrictions_get_(request): return Response( define.webpage( request.userid, "control/edit_tagrestrictions.html", (sorted(searchtag.query_user_restricted_tags(request.userid)), ), title="Edit Community Tagging Restrictions"))
def test_edit_user_tag_restrictions_fully_clear_entries_after_adding_items(): user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) tags = set() searchtag.edit_user_tag_restrictions(user_id, tags) assert searchtag.query_user_restricted_tags(user_id) == []
def test_edit_user_tag_restrictions_fully_clear_entries_after_adding_items(): user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) tags = set() searchtag.edit_user_tag_restrictions(user_id, tags) assert searchtag.query_user_restricted_tags(user_id) == set()
def control_tagrestrictions_post_(request): tags = searchtag.parse_restricted_tags(request.params["tags"]) searchtag.edit_user_tag_restrictions(request.userid, tags) return Response( define.webpage( request.userid, "control/edit_tagrestrictions.html", (searchtag.query_user_restricted_tags(request.userid), ), title="Edit Community Tagging Restrictions"))
def test_edit_user_tag_restrictions_with_no_prior_entries(): """ Verify that we can successfully set new user restricted tags when no existing tags have been set for a given user previously. """ user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) resultant_tags = set(searchtag.query_user_restricted_tags(user_id)) assert resultant_tags == valid_tags
def test_edit_user_tag_restrictions_with_no_prior_entries(): """ Verify that we can successfully set new user restricted tags when no existing tags have been set for a given user previously. """ user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) resultant_tags = searchtag.query_user_restricted_tags(user_id) assert resultant_tags == valid_tags
def test_edit_user_tag_restrictions_with_prior_entries_test_removal_of_entry(): # Setup user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) tags_to_keep = {'test', 'te*st', 'test_too'} # Set the new tags; AKA, remove the two defined tags tags = searchtag.parse_restricted_tags(", ".join(tags_to_keep)) searchtag.edit_user_tag_restrictions(user_id, tags) resultant_tags = set(searchtag.query_user_restricted_tags(user_id)) assert resultant_tags == tags_to_keep
def test_edit_user_tag_restrictions_with_prior_entries_test_removal_of_entry(): # Setup user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) tags_to_keep = {'test', 'te*st', 'test_too'} # Set the new tags; AKA, remove the two defined tags tags = searchtag.parse_restricted_tags(", ".join(tags_to_keep)) searchtag.edit_user_tag_restrictions(user_id, tags) resultant_tags = searchtag.query_user_restricted_tags(user_id) assert resultant_tags == tags_to_keep
def control_tagrestrictions_post_(request): tags = searchtag.parse_restricted_tags(request.params["tags"]) searchtag.edit_user_tag_restrictions(request.userid, tags) return Response(define.webpage(request.userid, "control/edit_tagrestrictions.html", ( searchtag.query_user_restricted_tags(request.userid), ), title="Edit Community Tagging Restrictions"))
def control_tagrestrictions_get_(request): return Response(define.webpage(request.userid, "control/edit_tagrestrictions.html", ( searchtag.query_user_restricted_tags(request.userid), ), title="Edit Community Tagging Restrictions"))
def test_get_user_tag_restrictions(): user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) resultant_tags = searchtag.query_user_restricted_tags(user_id) assert resultant_tags == valid_tags
def test_get_user_tag_restrictions(): user_id = db_utils.create_user() tags = searchtag.parse_restricted_tags(", ".join(combined_tags)) searchtag.edit_user_tag_restrictions(user_id, tags) resultant_tags = searchtag.query_user_restricted_tags(user_id) assert resultant_tags == valid_tags