def test_load_messages_on_message_thread(): user = User() content = 'a message was sent' their_profile = user.quickmatch() message_info = their_profile.message(content) while message_info.message_id is None: their_profile = user.quickmatch() message_info = their_profile.message(content) assert len(user.outbox[0].messages) == 1 assert user.outbox[0].messages[0].content == content
def test_initiator_and_respondent(): user = User() their_profile = user.quickmatch() message_info = their_profile.message('initiated contact') while message_info.message_id is None: their_profile = user.quickmatch() message_info = their_profile.message('initiated contact') message_thread = user.outbox[0] assert message_thread.initiator.username == user.profile.username assert message_thread.respondent.username == their_profile.username assert message_thread.correspondent_id == their_profile.id
def test_mailbox_sync_integration(T): user = User() T.factory.okcupyd_user(user) user.quickmatch().message('test... sorry.') Sync(user).all() user_model = model.User.find(user.profile.id, id_key='okc_id') messages = model.Message.query(model.Message.sender_id == user_model.id) Sync(user).all() assert len(messages) == len( model.Message.query(model.Message.sender_id == user_model.id))
def test_multi_line_messages(vcr_live_sleep): user = User() messages = [ """Multi-line message first second third""", """ leading whitespace space at the end space at the beggining """ ] for message in messages: user.quickmatch().message(message) vcr_live_sleep(2) assert user.outbox()[0].messages[0].content.strip() == message.strip()
def test_multi_line_messages(vcr_live_sleep): user = User() messages = [ """Multi-line message first second third""", """ leading whitespace space at the end space at the beggining """] for message in messages: user.quickmatch().message(message) vcr_live_sleep(2) assert user.outbox()[0].messages[0].content.strip() == message.strip()
def test_photo_delete(): user = User() response_dict = user.photo.upload_and_confirm(user.quickmatch().photo_infos[0]) before_delete_photos = user.profile.photo_infos user.photo.delete(response_dict['id']) user.profile.refresh() assert len(before_delete_photos) - 1 == len(user.profile.photo_infos)
def test_user_delete_threads(): user = User() message_info = user.message(user.quickmatch().username, 'abcdefghijklmnopqrstuvwxyz') assert message_info.thread_id != None user.delete_threads(user.outbox()) assert user.outbox()[:] == []
def test_photo_delete(): user = User() response_dict = user.photo.upload_and_confirm( user.quickmatch().photo_infos[0]) before_delete_photos = user.profile.photo_infos user.photo.delete(response_dict['id']) user.profile.refresh() assert len(before_delete_photos) - 1 == len(user.profile.photo_infos)
def test_mailbox_sync_integration(T): user = User() T.factory.okcupyd_user(user) user.quickmatch().message('test... sorry.') Sync(user).all() user_model = model.User.find(user.profile.id, id_key='okc_id') messages = model.Message.query( model.Message.sender_id == user_model.id ) Sync(user).all() assert len(messages) == len(model.Message.query( model.Message.sender_id == user_model.id ))
def test_user_get_user_question(): user = User() profile = user.quickmatch() question = profile.questions[0] user_question = user.get_user_question(question) assert question.id == user_question.id assert question.text == user_question.text assert 0 < user_question.answer_id < 5 assert 0 < user_question.get_answer_id_for_question(question) < 5
def test_delete(vcr_live_sleep): user = User() their_profile = user.quickmatch() message_info = their_profile.message('text') assert message_info.thread_id != None thread_id = user.outbox[0].id user.outbox[0].delete() vcr_live_sleep(2) user.outbox() try: assert user.outbox[0].id != thread_id except IndexError: pass
def test_reply(): user = User() user.quickmatch().message('test') message_info = user.outbox[0].reply('reply') assert message_info.thread_id is not None assert int(message_info.message_id) > 0
def test_question_answer_id_for_profile_question(): user = User() assert isinstance(user.get_question_answer_id(user.quickmatch().questions[0]), int)
def rate_attractive_girls(): user = User() while True: p = user.quickmatch() if user.attractiveness_finder(p.username) >= 7000: p.rate(5)
def test_user_message(): user = User() message_info = user.message(user.quickmatch().username, 'abcdefghijklmnopqrstuvwxyz') assert message_info.thread_id != None assert int(message_info.message_id) > 0
def test_photo_info_upload(vcr_live_sleep): user = User() response = user.photo.upload_and_confirm(user.quickmatch().photo_infos[0]) vcr_live_sleep(2) assert int(response['id']) in [pi.id for pi in user.profile.photo_infos]