def reply_deleted_post_4(request, participant2_user, discussion, reply_post_1, test_session): """ From participant2_user, in reply to reply_post_1 """ from assembl.models import Post, LangString, PublicationStates p = Post(discussion=discussion, creator=participant2_user, subject=LangString.create(u"re2: root post"), body=LangString.create(u"post body"), publication_state=PublicationStates.DELETED_BY_ADMIN, type="post", message_id="*****@*****.**") test_session.add(p) test_session.flush() p.set_parent(reply_post_1) test_session.flush() def fin(): print "finalizer reply_deleted_post_4" test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def post_related_to_sub_idea_1_1_1( request, test_session, discussion, admin_user, subidea_1_1_1): from assembl.models import Post, LangString, IdeaRelatedPostLink idea = subidea_1_1_1 p = Post( discussion=discussion, creator=admin_user, subject=LangString.create(u"A post subject related to sub_idea_1_1_1"), body=LangString.create(u"A post body related to sub_idea_1_1_1"), creation_date=datetime(2018, 2, 17, 9, 0, 0), # in the thread phase date range (see phases fixture) type='post', message_id="*****@*****.**") idc = IdeaRelatedPostLink( idea=idea, creator=admin_user, content=p) test_session.add(p) test_session.add(idc) test_session.flush() def fin(): print "finalizer post_related_to_sub_idea_1_1_1" test_session.delete(p) test_session.delete(idc) test_session.flush() request.addfinalizer(fin) return p
def post_related_to_sub_idea_1( request, test_session, discussion, admin_user, subidea_1): from assembl.models import Post, LangString, IdeaRelatedPostLink idea = subidea_1 p = Post( discussion=discussion, creator=admin_user, subject=LangString.create(u"A post related to sub_idea_1 "), body=LangString.create(u"A post related to sub_idea_1"), type='post', message_id="*****@*****.**") idc = IdeaRelatedPostLink( idea=idea, creator=admin_user, content=p) test_session.add(p) test_session.add(idc) test_session.flush() def fin(): print "finalizer root_post_en_under_positive_column_of_idea" test_session.delete(p) test_session.delete(idc) test_session.flush() request.addfinalizer(fin) return p
def root_post_with_tags(request, participant1_user, discussion, test_session, tags): """ From participant1_user """ from assembl.models import Post, LangString p = Post(discussion=discussion, creator=participant1_user, subject=LangString.create(u"a root post"), body=LangString.create(u"post body"), moderator=None, creation_date=datetime(year=2000, month=1, day=1), type="post", message_id="*****@*****.**") p.tags = tags test_session.add(p) test_session.flush() def fin(): print("finalizer root_post_with_tags") p.tags = [] test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def creativity_session_widget_post(request, test_session, discussion, participant1_user, creativity_session_widget, creativity_session_widget_new_idea): """A Post fixture with a bound to a creativity widget to a new idea and an idea content link""" from assembl.models import (Post, IdeaContentWidgetLink, LangString) p = Post(discussion=discussion, creator=participant1_user, subject=LangString.create(u"re: generated idea"), body=LangString.create(u"post body"), type="post", message_id="*****@*****.**") test_session.add(p) test_session.flush() icwl = IdeaContentWidgetLink(content=p, idea=creativity_session_widget_new_idea, creator=participant1_user) test_session.add(icwl) def fin(): print "finalizer creativity_session_widget_post" test_session.delete(icwl) test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def root_post_1_with_positive_message_classifier(request, participant1_user, idea_message_column_positive, discussion, test_session): """ From participant1_user """ from assembl.models import Post, LangString p = Post( discussion=discussion, creator=participant1_user, subject=LangString.create(u"a root post"), body=LangString.create(u"post body"), moderator=None, creation_date=datetime(year=2000, month=1, day=1), type="post", message_id="*****@*****.**", message_classifier=idea_message_column_positive.message_classifier) test_session.add(p) test_session.flush() def fin(): print("finalizer root_post_1") test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def post_related_to_sub_idea_1_participant2(request, test_session, discussion, participant2_user, subidea_1): from assembl.models import Post, LangString, IdeaRelatedPostLink idea = subidea_1 p = Post(discussion=discussion, creator=participant2_user, subject=LangString.create(u"A post related to sub_idea_1 "), body=LangString.create(u"A post related to sub_idea_1"), creation_date=datetime(year=2000, month=1, day=6), type='post', message_id="*****@*****.**") idc = IdeaRelatedPostLink(idea=idea, creator=participant2_user, content=p) test_session.add(p) test_session.add(idc) test_session.flush() def fin(): test_session.delete(p) test_session.delete(idc) test_session.flush() request.addfinalizer(fin) return p
def reply_post_1(request, participant2_user, discussion, root_post_1, test_session): """ From participant2_user, in reply to root_post_1 """ from assembl.models import Post, LangString p = Post( discussion=discussion, creator=participant2_user, subject=LangString.create(u"re1: root post"), body=LangString.create( u"post body with some text so we can test harvesting features. I'm writing a very topical comment with an unrelated source, hoping it would make people angry and make them write answers. I have read in '17O Solid-State NMR Spectroscopy of Functional Oxides for Energy Conversion' thesis by Halat, D. M. (2018) that variable-temperature spectra indicate the onset of oxide-ion motion involving the interstitials at 130 °C, which is linked to an orthorhombic−tetragonal phase transition. For the V-doped phases, an oxide-ion conduction mechanism is observed that involves oxygen exchange between the Bi-O sublattice and rapidly rotating VO4 tetrahedral units. The more poorly conducting P-doped phase exhibits only vacancy conduction with no evidence of sublattice exchange, a result ascribed to the differing propensities of the dopants to undergo variable oxygen coordination. So I think it would be a very bad idea to allow hot beverages in coworking spaces. But it looks like people don't really care about scientific evidence around here." ), creation_date=datetime(year=2000, month=1, day=4), type="post", message_id="*****@*****.**") test_session.add(p) test_session.flush() p.set_parent(root_post_1) test_session.flush() def fin(): print("finalizer reply_post_1") test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def root_post_en_under_positive_column_of_idea( request, test_session, discussion, admin_user, idea_message_column_positive): from assembl.models import Post, LangString, IdeaRelatedPostLink idea = idea_message_column_positive.idea p = Post( discussion=discussion, creator=admin_user, subject=LangString.create(u"A simple positive subject"), body=LangString.create(u"A simple positive body"), type='post', message_id="*****@*****.**", message_classifier=idea_message_column_positive.message_classifier) idc = IdeaRelatedPostLink( idea=idea, creator=admin_user, content=p) test_session.add(p) test_session.add(idc) test_session.flush() def fin(): print "finalizer root_post_en_under_positive_column_of_idea" test_session.delete(p) test_session.delete(idc) test_session.flush() request.addfinalizer(fin) return p
def post_draft_for_bright_mirror( request, test_session, discussion, moderator_user, bright_mirror): from assembl.models import Post, Idea, LangString, IdeaRelatedPostLink, PublicationStates from graphene.relay import Node idea_id = bright_mirror raw_id = int(Node.from_global_id(idea_id)[1]) idea = Idea.get(raw_id) p = Post( discussion=discussion, creator=moderator_user, subject=LangString.create(u"Draft"), body=LangString.create(u"A simple draft fiction"), type='post', publication_state=PublicationStates.DRAFT, message_id="*****@*****.**", creation_date = datetime.utcnow() - timedelta(days=7)) idc = IdeaRelatedPostLink( idea=idea, creator=moderator_user, content=p) test_session.add(p) test_session.add(idc) test_session.flush() def fin(): print "finalizer post_draft_for_bright_mirror" test_session.delete(p) test_session.delete(idc) test_session.flush() request.addfinalizer(fin) return p
def reply_post_1(request, participant2_user, discussion, root_post_1, test_session): """ From participant2_user, in reply to root_post_1 """ from assembl.models import Post, LangString p = Post(discussion=discussion, creator=participant2_user, subject=LangString.create(u"re1: root post"), body=LangString.create(u"post body"), creation_date=datetime(year=2000, month=1, day=4), type="post", message_id="*****@*****.**") test_session.add(p) test_session.flush() p.set_parent(root_post_1) test_session.flush() def fin(): print "finalizer reply_post_1" test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def post_published_for_bright_mirror_participant( request, test_session, discussion, admin_user, participant1_user, bright_mirror): from assembl.models import Post, Idea, LangString, IdeaRelatedPostLink, PublicationStates from graphene.relay import Node idea_id = bright_mirror raw_id = int(Node.from_global_id(idea_id)[1]) idea = Idea.get(raw_id) p = Post( discussion=discussion, creator=participant1_user, subject=LangString.create(u"Published by participant"), body=LangString.create(u"A simple published fiction by participant"), type='post', publication_state=PublicationStates.PUBLISHED, message_id="*****@*****.**", creation_date = datetime.utcnow()) idc = IdeaRelatedPostLink( idea=idea, creator=admin_user, content=p) test_session.add(p) test_session.add(idc) test_session.flush() def fin(): print "finalizer post_published_for_bright_mirror" test_session.delete(p) test_session.delete(idc) test_session.flush() request.addfinalizer(fin) return p
def post_body_locale_determined_by_creator( request, test_session, discussion, admin_user, user_language_preference_fr_cookie): from assembl.models import Post, LangString p = Post( discussion=discussion, creator=admin_user, subject=LangString.create(u"testa"), body=LangString.create(u"testa"), message_id="*****@*****.**") test_session.add(p) test_session.flush() def fin(): print("finalizer post_subject_locale_determined_by_creator") test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def discussion2_root_post_1(request, participant1_user, discussion2, test_session): """ From participant1_user """ from assembl.models import Post p = Post( discussion=discussion2, creator=participant1_user, subject=u"a root post", body=u"post body", creation_date=datetime(year=2000, month=1, day=2), type="post", message_id="msg1") test_session.add(p) test_session.flush() def fin(): print "finalizer discussion2_root_post_1" test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def discussion2_root_post_1(request, participant1_user, discussion2, test_session): """ From participant1_user """ from assembl.models import Post, LangString p = Post( discussion=discussion2, creator=participant1_user, subject=LangString.create(u"a root post"), body=LangString.create(u"post body"), creation_date=datetime(year=2000, month=1, day=2), parent=None, type="post", message_id="*****@*****.**") test_session.add(p) test_session.flush() def fin(): print("finalizer discussion2_root_post_1") test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def reply_post_3(request, participant2_user, discussion, root_post_1, test_session): """ From participant2_user, in reply to reply_post_2 """ from assembl.models import Post p = Post( discussion=discussion, creator=participant2_user, subject=u"re2: root post", body=u"post body", type="post", message_id="msg4") test_session.add(p) test_session.flush() p.set_parent(root_post_1) test_session.flush() def fin(): print "finalizer reply_post_3" test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def reply_post_2(request, participant1_user, discussion, reply_post_1, test_session): """ From participant1_user, in reply to reply_post_1 """ from assembl.models import Post p = Post( discussion=discussion, creator=participant1_user, subject=u"re2: root post", body=u"post body", creation_date=datetime(year=2000, month=1, day=5), type="post", message_id="msg3") test_session.add(p) test_session.flush() p.set_parent(reply_post_1) test_session.flush() def fin(): print "finalizer reply_post_2" test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p
def creativity_session_widget_post( request, test_session, discussion, participant1_user, creativity_session_widget, creativity_session_widget_new_idea): from assembl.models import (Post, IdeaContentWidgetLink) p = Post( discussion=discussion, creator=participant1_user, subject=u"re: generated idea", body=u"post body", type="post", message_id="comment_generated") test_session.add(p) test_session.flush() icwl = IdeaContentWidgetLink( content=p, idea=creativity_session_widget_new_idea, creator=participant1_user) test_session.add(icwl) def fin(): print "finalizer creativity_session_widget_post" test_session.delete(icwl) test_session.delete(p) test_session.flush() request.addfinalizer(fin) return i
def reply_to_deleted_post_5( request, participant1_user, discussion, reply_deleted_post_4, test_session): """ From participant2_user, in reply to root_post_1 """ from assembl.models import Post, LangString p = Post( discussion=discussion, creator=participant1_user, subject=LangString.create(u"re3: root post"), body=LangString.create(u"post body"), type="post", message_id="*****@*****.**") test_session.add(p) test_session.flush() p.set_parent(reply_deleted_post_4) test_session.flush() def fin(): print "finalizer reply_to_deleted_post_5" test_session.delete(p) test_session.flush() request.addfinalizer(fin) return p