def mockup(cls): session = cls.create_session() with StoreManager(session): with open(IMAGE_PATH, 'rb') as f: cls.message1 = Message( body='This is message 1', mimetype='image/png', attachment=io.BytesIO(f.read()), ) cls.message2 = Message(body='This is message 2', mimetype='text/plain') cls.message3 = Message(body='This is message 3', mimetype='text/plain') user1 = Member(email='*****@*****.**', title='user1', first_name='user1_first_name', last_name='user1_last_name', access_token='access token1', reference_id=2, messages=[cls.message1]) user2 = Member(email='*****@*****.**', title='user2', first_name='user2_first_name', last_name='user2_last_name', access_token='access token2', reference_id=3, messages=[cls.message3, cls.message2]) room1 = Room(title='room1', members=[user1, user2], messages=[cls.message1, cls.message3]) room2 = Room(title='room2', members=[user2], messages=[cls.message2]) session.add(user1) session.commit()
def mockup(cls): session = cls.create_session() cls.user1 = Member( email='*****@*****.**', title='user1', access_token='access token1', reference_id=2, ) cls.user2 = Member( email='*****@*****.**', title='user2', access_token='access token2', reference_id=3 ) cls.user3 = Member( email='*****@*****.**', title='user3', access_token='access token3', reference_id=4, ) cls.room1 = Room( title='room1', members=[cls.user1, cls.user2, cls.user3], ) session.add(cls.room1) cls.room2 = Room( title='room2', members=[cls.user1, cls.user2], ) session.add(cls.room2) session.commit()
def mockup(cls): session = cls.create_session() cls.member1 = Member(email='*****@*****.**', title='user1', first_name='user1_first_name', last_name='user1_last_name', access_token='access token1', reference_id=2) cls.member2 = Member(email='*****@*****.**', title='user2', first_name='user2_first_name', last_name='user2_last_name', access_token='access token2', reference_id=3) cls.member3 = Member(email='*****@*****.**', title='user3', first_name='user3_first_name', last_name='user3_last_name', access_token='access token3', reference_id=4) session.add(cls.member3) cls.room = Room(title='example', members=[cls.member1]) session.add(cls.room) direct1 = Direct(members=[cls.member1, cls.member2]) session.add(direct1) direct2 = Direct(members=[cls.member1, cls.member3]) session.add(direct2) session.commit()
def mockup(cls): session = cls.create_session() cls.envelop1 = Envelop(body='This is envelop 1') cls.envelop2 = Envelop(body='This is envelop 2') cls.envelop3 = Envelop(body='This is envelop 3') cls.envelop4 = Envelop(body='This is envelop 4') user1 = Member( email='*****@*****.**', title='user', first_name='user_first_name', last_name='user_last_name', access_token='access token1', reference_id=2, messages=[cls.envelop1, cls.envelop2, cls.envelop3, cls.envelop4]) room1 = Room( title='room1', members=[user1], messages=[cls.envelop1, cls.envelop2, cls.envelop3, cls.envelop4]) session.add(room1) session.commit()
def mockup(cls): session = cls.create_session() user1 = Member( title='user1', first_name='user1_first_name', last_name='user1_last_name', email='*****@*****.**', access_token='access token1', reference_id=2, ) cls.user2 = Member( title='user2', first_name='user2_first_name', last_name='user2_last_name', email='*****@*****.**', access_token='access token2', reference_id=3, ) cls.user3 = Member( title='user3', first_name='user3_first_name', last_name='user3_last_name', email='*****@*****.**', access_token='access token3', reference_id=4, ) session.add(cls.user3) cls.room = Room(title='room', members=[user1, cls.user2]) session.add(cls.room) session.commit()
def mockup(cls): session = cls.create_session(expire_on_commit=True) with StoreManager(session): with open(IMAGE_PATH, 'rb') as f: cls.message1 = Message( body='This is message 1', mimetype='image/png', attachment=io.BytesIO(f.read()), ) cls.message2 = Message(body='This is message 2', mimetype='text/plain') user = Member(title='user', first_name='user_first_name', last_name='user_last_name', email='*****@*****.**', access_token='access token', reference_id=1) session.add(user) user1 = Member(title='user1', first_name='user1_first_name', last_name='user1_last_name', email='*****@*****.**', access_token='access token1', reference_id=2, messages=[cls.message1, cls.message2]) cls.room = Room(title='room', messages=[cls.message1, cls.message2], members=[user1]) session.add(cls.room) cls.message2.soft_delete() session.commit()
def mockup(cls): cls.session = cls.create_session(expire_on_commit=True) with StoreManager(cls.session): cls.message1 = Message(body='This is message 1', mimetype='text/plain') cls.message2 = Message(body='This is message 2', mimetype='text/plain') cls.message3 = Message(body='This is message 3', mimetype='image/png', attachment=image_path) user = Member(email='*****@*****.**', title='user', access_token='access token', reference_id=1, messages=[cls.message1, cls.message3]) user1 = Member(email='*****@*****.**', title='user1', access_token='access token1', reference_id=2, messages=[cls.message2]) user2 = Member(email='*****@*****.**', title='user2', access_token='access token2', reference_id=3) room = Room(title='room', type='room', messages=[cls.message1, cls.message2, cls.message3], members=[user, user1]) cls.session.add(user2) cls.session.add(room) cls.session.commit()
def mockup(cls): session = cls.create_session() cls.member1 = Member(email='*****@*****.**', title='member1', first_name='member1_first_name', last_name='member1_last_name', access_token='access token', reference_id=1) cls.member2 = Member(email='*****@*****.**', title='member2', first_name='member2_first_name', last_name='member2_last_name', access_token='access token', reference_id=2) cls.member3 = Member(email='*****@*****.**', title='member3', first_name='member3_first_name', last_name='member3_last_name', access_token='access token', reference_id=3) session.add(cls.member3) cls.room = Room(title='room1', members=[cls.member1, cls.member2]) session.add(cls.room) session.commit()
def mockup(cls): session = cls.create_session() cls.message1 = Message( body='First message', mimetype='text/plain', ) cls.message2 = Message( body='Second message', mimetype='text/plain', ) cls.message3 = Message( body='Third message', mimetype='text/plain', ) cls.user1 = Member(email='*****@*****.**', title='user 1', first_name='user1_first_name', last_name='user1_last_name', access_token='access token1', reference_id=2, messages=[cls.message1, cls.message2]) cls.user2 = Member(email='*****@*****.**', title='user 2', first_name='user2_first_name', last_name='user2_last_name', access_token='access token2', reference_id=3, messages=[cls.message3]) cls.room1 = Room(title='room1', type='room', members=[cls.user1, cls.user2], messages=[cls.message3, cls.message1, cls.message2]) session.add(cls.room1) session.commit()
def mockup(cls): session = cls.create_session() member1 = Member(email='*****@*****.**', title='user1', access_token='access token1', reference_id=2) cls.room = Room(title='example', members=[member1]) session.add(cls.room) session.commit()
def mockup(cls): session = cls.create_session() cls.user1 = Member(email='*****@*****.**', title='user1', first_name='user1_first_name', last_name='user1_last_name', access_token='access token1', reference_id=2) cls.room = Room( title='example', type='room', members=[cls.user1], ) session.add(cls.room) session.commit()
def mockup(cls): session = cls.create_session() with StoreManager(session): with open(IMAGE_PATH, 'rb') as f: cls.message1 = Message( body='This is message 1', mimetype='text/plain', attachment=io.BytesIO(f.read()), ) message2 = Message( body='This is message 2', mimetype='text/plain', ) cls.message3 = Message( body='This is message 3', mimetype='text/plain', ) cls.user1 = Member( email='*****@*****.**', title='user1', access_token='access token1', reference_id=2, messages=[cls.message1, message2, cls.message3] ) cls.user2 = Member( email='*****@*****.**', title='user2', access_token='access token2', reference_id=3 ) session.add(cls.user2) room = Room( title='room', type='room', members=[cls.user1], messages=[cls.message1, message2, cls.message3] ) session.add(room) cls.message3.soft_delete() session.commit()
def mockup(cls): session = cls.create_session() with StoreManager(session): cls.message1 = Message( body='This is message 1', mimetype='text/plain', ) cls.message2 = Message( body='This is message 2', mimetype='text/plain', ) cls.message3 = Message( body='This is message 3', mimetype='text/plain', ) cls.message4 = Message( body='This is message 4', mimetype='text/plain', ) cls.message5 = Message(body='This is message 5', mimetype='image/png', attachment=image_path) cls.message6 = Message( body='This is message 6', mimetype='text/plain', ) user1 = Member(email='*****@*****.**', title='user', first_name='user_first_name', last_name='user_last_name', access_token='access token1', reference_id=2, messages=[ cls.message1, cls.message2, cls.message3, cls.message5 ]) user2 = Member(email='*****@*****.**', title='user2', first_name='user2_first_name', last_name='user2_last_name', access_token='access token2', reference_id=3, messages=[cls.message4, cls.message6]) session.add(user2) user3 = Member( email='*****@*****.**', title='user3', first_name='user3_first_name', last_name='user3_last_name', access_token='access token3', reference_id=4, ) room1 = Room(title='room1', type='room', members=[user1, user3], messages=[ cls.message1, cls.message3, cls.message4, cls.message5, cls.message6 ]) session.add(room1) room2 = Room( title='room2', type='room', members=[user1, user3], messages=[cls.message2], ) session.add(room2) session.commit()
def mockup(cls): session = cls.create_session() with StoreManager(session): with open(IMAGE_PATH, 'rb') as f: cls.user1 = Member( email='*****@*****.**', title='user', first_name='user_first_name', last_name='user_last_name', access_token='access token', reference_id=1, ) session.add(cls.user1) cls.user2 = Member( email='*****@*****.**', title='user2', first_name='user2_first_name', last_name='user2_last_name', access_token='access token2', reference_id=2, ) session.add(cls.user2) room = Room( title='room', type='room', members=[cls.user1, cls.user2] ) session.add(room) session.flush() auditlog_message1 = Message( body='{"log": 1}', mimetype='application/x-auditlog', target_id=room.id, sender_id=cls.user2.id, ) session.add(auditlog_message1) auditlog_message2 = Message( body='{"log": 1}', mimetype='application/x-auditlog', target_id=room.id, sender_id=cls.user2.id, ) session.add(auditlog_message2) auditlog_message3 = Message( body='{"log": 1}', mimetype='application/x-auditlog', target_id=room.id, sender_id=cls.user2.id, ) session.add(auditlog_message3) cls.message1 = Message( body='This is message 1', mimetype='text/plain', target_id=room.id, sender_id=cls.user1.id, ) session.add(cls.message1) cls.message2 = Message( body='This is message 2', mimetype='text/plain', target_id=room.id, sender_id=cls.user1.id ) session.add(cls.message2) cls.message3 = Message( body='This is message 3', mimetype='text/plain', target_id=room.id, sender_id=cls.user2.id, attachment=io.BytesIO(f.read()), ) session.add(cls.message3) session.flush() cls.message4 = Message( body='This is message 4', mimetype='text/plain', target_id=room.id, sender_id=cls.user2.id, ) session.add(cls.message3) member_message_seen1 = MemberMessageSeen( member_id=cls.user1.id, message_id=cls.message1.id ) session.add(member_message_seen1) member_message_seen2 = MemberMessageSeen( member_id=cls.user1.id, message_id=cls.message2.id ) session.add(member_message_seen2) session.commit() cls.auditlog_message1_id = auditlog_message1.id cls.auditlog_message2_id = auditlog_message2.id cls.auditlog_message3_id = auditlog_message3.id
HERE = path.abspath(path.dirname(__file__)) DATA_DIRECTORY = path.abspath(path.join(HERE, '../../data')) _cas_server_status = 'idle' _maestro_server_status = 'idle' query=FieldInfo(type_=str, required=True, not_none=True).to_json() user_id=FieldInfo(type_=str, required=True, not_none=True).to_json() member_id=FieldInfo(type_=str, required=True, not_none=True).to_json() authorization_code=FieldInfo(type_=str, required=True, not_none=True).to_json() room_fields = Room.json_metadata()['fields'] member_fields = dict(query=query) contact_fields = dict(userId=user_id) target_fields = dict(userId=user_id, memberId=member_id) target_fields.update(room_fields) authorization_fields= dict(authorizationCode=authorization_code) class AutoDocumentationBDDTest(ApplicableTestCase): __application_factory__ = Jaguar __story_directory__ = path.join(DATA_DIRECTORY, 'stories') __api_documentation_directory__ = path.join(DATA_DIRECTORY, 'markdown') __configuration__ = ''' room: subscription: max_length: 5