Beispiel #1
0
def test_slugify_topic_if_slug_is_empty(discussion):
    from assembl.lib.utils import slugify
    from assembl.models.discussion import slugify_topic_if_slug_is_empty
    slugify_topic_if_slug_is_empty(discussion, discussion.topic, "oldvalue",
                                   "initiator")
    assert discussion.slug != str(slugify(discussion.topic))
    discussion.slug = ""
    slugify_topic_if_slug_is_empty(discussion, discussion.topic, "oldvalue",
                                   "initiator")
    assert (discussion.slug) == str(slugify(discussion.topic))
Beispiel #2
0
def test_slugify_topic_if_slug_is_empty(discussion):
    from assembl.lib.utils import slugify
    from assembl.models.discussion import slugify_topic_if_slug_is_empty
    slugify_topic_if_slug_is_empty(
        discussion,
        discussion.topic,
        "oldvalue",
        "initiator")
    assert discussion.slug != str(slugify(discussion.topic))
    discussion.slug = ""
    slugify_topic_if_slug_is_empty(
        discussion,
        discussion.topic,
        "oldvalue",
        "initiator")
    assert (discussion.slug) == str(slugify(discussion.topic))
Beispiel #3
0
def slugify_topic_if_slug_is_empty(discussion, topic, oldvalue, initiator):
    """
    if the target doesn't have a slug, slugify the topic and use that.
    """
    if not discussion.slug:
        discussion.slug = slugify(topic)
Beispiel #4
0
def slugify_topic_if_slug_is_empty(discussion, topic, oldvalue, initiator):
    """
    if the target doesn't have a slug, slugify the topic and use that.
    """
    if not discussion.slug:
        discussion.slug = slugify(topic)