Example #1
0
def test_url_to_post_v1_without_timeline(discussion, root_post_1):
    from assembl.lib.frontend_urls import (FrontendUrls,
                                           get_current_phase_identifier,
                                           current_phase_use_v1_interface)
    frontend_urls = FrontendUrls(discussion)
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is True
    assert '/debate/jacklayton2/posts/local' in\
        frontend_urls.get_post_url(root_post_1)
Example #2
0
def xtest_url_to_fiction(discussion, post_published_for_bright_mirror):
    fiction = post_published_for_bright_mirror
    from assembl.lib.frontend_urls import FrontendUrls
    frontend_urls = FrontendUrls(discussion)
    phase = fiction.get_created_phase()
    expected = 'jacklayton2/debate/{}/theme/{}/fictions/{}'.format(
        phase.identifier,
        fiction.get_ideas()[0].graphene_id(), fiction.graphene_id())
    actual = frontend_urls.get_post_url(fiction)
    assert expected in actual
Example #3
0
def test_url_to_post_v1_with_timeline(discussion, root_post_1,
                                      timeline_phase2_interface_v1):
    from assembl.lib.frontend_urls import (
        FrontendUrls,
        get_current_phase_identifier,
        current_phase_use_v1_interface
    )
    frontend_urls = FrontendUrls(discussion)
    assert get_current_phase_identifier(discussion.timeline_events) == u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is True
    assert '/debate/jacklayton2/posts/local' in frontend_urls.get_post_url(root_post_1)
Example #4
0
def test_url_to_post_v2(discussion, root_post_en_under_positive_column_of_idea,
                        timeline_phase2_interface_v2):
    from assembl.lib.frontend_urls import (FrontendUrls,
                                           get_current_phase_identifier,
                                           current_phase_use_v1_interface)
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    frontend_urls = FrontendUrls(discussion)
    assert 'jacklayton2/debate/thread/theme/' in \
        frontend_urls.get_post_url(root_post_en_under_positive_column_of_idea)
Example #5
0
def test_url_to_synthesis_post_with_timeline(discussion, synthesis_post_1,
                                             timeline_phase2_interface_v2):
    from assembl.lib.frontend_urls import (FrontendUrls,
                                           get_current_phase_identifier,
                                           current_phase_use_v1_interface)
    frontend_urls = FrontendUrls(discussion)
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    post_id = synthesis_post_1.graphene_id()
    assert '/syntheses/{id}'.format(id=post_id)\
        in frontend_urls.get_post_url(synthesis_post_1)
Example #6
0
def test_url_to_post_v2_proposal(discussion, proposals_en_fr,
                                 timeline_phase2_interface_v2):
    from assembl.lib.frontend_urls import (FrontendUrls,
                                           get_current_phase_identifier,
                                           current_phase_use_v1_interface)
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    frontend_urls = FrontendUrls(discussion)
    expected = 'jacklayton2/debate/thread/theme/'
    actual = frontend_urls.get_post_url(proposals_en_fr[0])
    assert expected in actual
Example #7
0
def test_url_to_post_v2(discussion, root_post_en_under_positive_column_of_idea,
                        timeline_phase2_interface_v2, test_session):
    from assembl.lib.frontend_urls import (
        FrontendUrls,
        get_current_phase_identifier,
        current_phase_use_v1_interface
    )
    phase = root_post_en_under_positive_column_of_idea.get_created_phase()
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    frontend_urls = FrontendUrls(discussion)
    assert 'jacklayton2/debate/{}/theme/'.format(phase.identifier) in \
        frontend_urls.get_post_url(root_post_en_under_positive_column_of_idea)
Example #8
0
def test_url_to_synthesis_post_with_timeline(discussion, synthesis_post_1,
                                             timeline_phase2_interface_v2):
    from assembl.lib.frontend_urls import (
        FrontendUrls,
        get_current_phase_identifier,
        current_phase_use_v1_interface
    )
    frontend_urls = FrontendUrls(discussion)
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    post_id = synthesis_post_1.graphene_id()
    assert '/syntheses/{id}'.format(id=post_id)\
        in frontend_urls.get_post_url(synthesis_post_1)
Example #9
0
def test_url_to_post_v2_proposal(discussion, proposals_en_fr,
                                 timeline_phase2_interface_v2, test_session):
    from assembl.lib.frontend_urls import (
        FrontendUrls,
        get_current_phase_identifier,
        current_phase_use_v1_interface
    )
    proposal = proposals_en_fr[0]
    phase = proposal.get_created_phase()
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    frontend_urls = FrontendUrls(discussion)
    expected = 'jacklayton2/debate/{}/theme/'.format(phase.identifier)
    actual = frontend_urls.get_post_url(proposals_en_fr[0])
    assert expected in actual
Example #10
0
def test_url_to_post_v2_proposal(discussion, proposals_en_fr,
                                 timeline_phase2_interface_v2, test_session):
    from assembl.lib.frontend_urls import (FrontendUrls,
                                           get_current_phase_identifier,
                                           current_phase_use_v1_interface)
    proposal = proposals_en_fr[0]
    phase = proposal.get_created_phase()
    assert get_current_phase_identifier(discussion.timeline_events) ==\
        u'thread'
    assert current_phase_use_v1_interface(discussion.timeline_events) is False
    frontend_urls = FrontendUrls(discussion)
    expected = 'jacklayton2/debate/{}/question/{}/1/#{}'.format(
        phase.identifier,
        proposal.get_ideas()[0].graphene_id(),
        proposals_en_fr[0].graphene_id())
    actual = frontend_urls.get_post_url(proposals_en_fr[0])
    assert expected in actual
Example #11
0
 def get_url(self):
     from assembl.lib.frontend_urls import FrontendUrls
     frontendUrls = FrontendUrls(self.discussion)
     return frontendUrls.get_post_url(self)
Example #12
0
 def get_url(self):
     from assembl.lib.frontend_urls import FrontendUrls
     frontendUrls = FrontendUrls(self.discussion)
     return frontendUrls.get_post_url(self)