Esempio n. 1
0
def test_log_path_for_user_question_not_found(mock_time):
    mock_time.time.return_value = 2
    user = User(mock.Mock())
    with mock.patch('okcupyd.profile.Profile.find_question',
                    return_value=None):
        user.get_user_question(mock.Mock())
    assert mock_time.sleep.call_count
Esempio n. 2
0
def test_log_path_for_user_question_not_found(mock_time):
    mock_time.time.return_value = 2
    user = User(mock.Mock())
    with mock.patch('okcupyd.profile.Profile.find_question',
                    return_value=None):
        user.get_user_question(mock.Mock())
    assert mock_time.sleep.call_count
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
def test_user_essay_refresh():
    # Test Refresh Function
    user = User()
    user2 = User(user._session)
    user.message_me_if = 'other stuff'

    user2.profile.essays.refresh()
    assert user.profile.essays.message_me_if == user2.profile.essays.message_me_if
Esempio n. 6
0
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
Esempio n. 7
0
def test_user_essay_refresh():
    # Test Refresh Function
    user = User()
    user2 = User(user._session)
    user.message_me_if = 'other stuff'

    user2.profile.essays.refresh()
    assert user.profile.essays.message_me_if == (
        user2.profile.essays.message_me_if)
Esempio n. 8
0
def test_handle_no_fluency_lanaguages(vcr_live_sleep):
    details = User().profile.details
    details.languages = [('english', None)]
    vcr_live_sleep(sleep_time)
    assert details.languages == [('English', None)]

    details.languages = [('spanish', None)]
    vcr_live_sleep(sleep_time)
    assert details.languages == [('Spanish', None)]
Esempio n. 9
0
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
Esempio n. 10
0
def test_handle_no_fluency_lanaguages(vcr_live_sleep):
    details = User().profile.details
    details.languages = [('english', None)]
    vcr_live_sleep(sleep_time)
    assert details.languages == [('English', None)]

    details.languages = [('spanish', None)]
    vcr_live_sleep(sleep_time)
    assert details.languages == [('Spanish', None)]
Esempio n. 11
0
def test_question_filter_with_custom_answers():
    user = User()
    user_question = user.questions.somewhat_important[1]
    unacceptable_answers = [answer_option.id
                            for answer_option in user_question.answer_options
                            if not answer_option.is_match]
    for profile in user.search(question=user_question.id,
                               question_answers=unacceptable_answers)[:5]:
        question = profile.find_question(user_question.id)
        assert not question.their_answer_matches
Esempio n. 12
0
def test_search_populates_upfront():
    user = User()
    search_fetchable = user.search()
    for profile in search_fetchable[:4]:
        profile_session = profile._session
        with mock.patch.object(profile, '_session') as mock_session:
            mock_session.okc_get.side_effect = profile_session.okc_get
            assert profile.id > 0
            assert mock_session.okc_get.call_count == 0
            profile.essays.self_summary
            assert mock_session.okc_get.call_count == 1
Esempio n. 13
0
def test_question_filter_with_custom_answers():
    user = User()
    user_question = user.questions.somewhat_important[1]
    unacceptable_answers = [
        answer_option.id for answer_option in user_question.answer_options
        if not answer_option.is_match
    ]
    for profile in user.search(question=user_question.id,
                               question_answers=unacceptable_answers)[:5]:
        question = profile.find_question(user_question.id)
        assert not question.their_answer_matches
Esempio n. 14
0
def test_search_populates_upfront():
    user = User()
    search_fetchable = user.search()
    for profile in search_fetchable[:4]:
        profile_session = profile._session
        with mock.patch.object(profile, '_session') as mock_session:
            mock_session.okc_get.side_effect = profile_session.okc_get
            assert profile.id > 0
            assert mock_session.okc_get.call_count == 0
            profile.essays.self_summary
            assert mock_session.okc_get.call_count == 1
Esempio n. 15
0
def test_profile_questions_copy(vcr_live_sleep):
    # This could be better...
    with mock.patch('okcupyd.profile_copy.time.sleep', vcr_live_sleep):
        user = User()
        # Find a user that has answered fewer than 50 questions.
        # This is going to issue an insane number of requests if we don't do this
        profile = get_profile_with_max_questions(user, max_questions=50)
        user.copy(profile).questions()

        for question in profile.questions():
            assert question.their_answer == question.my_answer
Esempio n. 16
0
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
Esempio n. 17
0
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
Esempio n. 18
0
def test_monogamous_detail(vcr_live_sleep):
    details = User().profile.details

    details.monogamous = None
    assert details.monogamous == None

    for fidelity_type in ('non-monogamous', 'monogamous'):
        for strictness in ('strictly', 'mostly'):
            details.monogamous = '{0} {1}'.format(strictness, fidelity_type)
            vcr_live_sleep(sleep_time)
            assert strictness in details.monogamous.lower()
            assert fidelity_type in details.monogamous.lower()
Esempio n. 19
0
def test_pets_detail(vcr_live_sleep):
    details = User().profile.details
    for relationship in ('has', 'likes', 'dislikes'):
        for pet in ('cats', 'dogs'):
            details.pets = '{0} {1}'.format(relationship, pet)
            vcr_live_sleep(sleep_time)
            assert relationship in details.pets.lower()
            assert pet in details.pets.lower()
            vcr_live_sleep(sleep_time)
    details.pets = 'has cats likes dogs'
    vcr_live_sleep(sleep_time)
    assert details.pets.lower() == 'likes dogs and has cats'
Esempio n. 20
0
def test_pets_detail(vcr_live_sleep):
    details = User().profile.details
    for relationship in ('has', 'likes', 'dislikes'):
        for pet in ('cats', 'dogs'):
            details.pets = '{0} {1}'.format(relationship, pet)
            vcr_live_sleep(sleep_time)
            assert relationship in details.pets.lower()
            assert pet in details.pets.lower()
            vcr_live_sleep(sleep_time)
    details.pets = 'has cats likes dogs'
    vcr_live_sleep(sleep_time)
    assert details.pets.lower() == 'likes dogs and has cats'
Esempio n. 21
0
def test_monogamous_detail(vcr_live_sleep):
    details = User().profile.details

    details.monogamous = None
    assert details.monogamous == None

    for fidelity_type in ('non-monogamous', 'monogamous'):
        for strictness in ('strictly', 'mostly'):
            details.monogamous = '{0} {1}'.format(strictness, fidelity_type)
            vcr_live_sleep(sleep_time)
            assert strictness in details.monogamous.lower()
            assert fidelity_type in details.monogamous.lower()
Esempio n. 22
0
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
Esempio n. 23
0
def test_languages_detail(vcr_live_sleep):
    details = User().profile.details

    values = [
        [('spanish', 'poorly'), ('english', 'fluently')],
        [('catalan', 'okay')],
        [('esperanto', 'fluently'), ('dutch', 'okay')],
    ]
    for value in values:
        details.languages = value
        vcr_live_sleep(sleep_time)
        assert details.languages == value
        vcr_live_sleep(sleep_time)
Esempio n. 24
0
def test_languages_detail(vcr_live_sleep):
    details = User().profile.details

    values = [
        [('spanish', 'poorly'), ('english', 'fluently')],
        [('catalan', 'okay')],
        [('esperanto', 'fluently'), ('dutch', 'okay')],
    ]
    for value in values:
        details.languages = value
        vcr_live_sleep(sleep_time)
        assert details.languages == value
        vcr_live_sleep(sleep_time)
Esempio n. 25
0
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
Esempio n. 26
0
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
Esempio n. 27
0
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
Esempio n. 28
0
def test_profile_questions_copy(vcr_live_sleep):
    # This could be better...
    with mock.patch('okcupyd.profile_copy.time.sleep', vcr_live_sleep):
        user = User()
        # Find a user that has answered fewer than 50 questions.
        # This is going to issue an insane number of requests if we don't do this
        profile = get_profile_with_max_questions(
            user, max_questions=50
        )
        user.copy(profile).questions()

        for question in profile.questions():
            assert question.their_answer == question.my_answer
Esempio n. 29
0
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))
Esempio n. 30
0
def test_nulling_of_details(vcr_live_sleep):
    details = User().profile.details
    details.ethnicities = ['white']
    vcr_live_sleep(sleep_time)
    assert 'white' in [ethnicity.lower() for ethnicity in details.ethnicities]
    vcr_live_sleep(sleep_time)
    details.ethnicities = []
    vcr_live_sleep(sleep_time)
    assert details.ethnicities == []

    details.bodytype = 'jacked'
    vcr_live_sleep(sleep_time)
    assert 'jacked' in details.bodytype.lower()
    details.bodytype = None
    vcr_live_sleep(sleep_time)
    assert not details.bodytype
    vcr_live_sleep(sleep_time)

    details.languages = [('spanish', 'fluently'), ('english', 'fluently')]
    vcr_live_sleep(sleep_time)
    assert 'spanish' in [language[0] for language in details.languages]
    # It appears that it's impossible to remove all languages.
    details.languages = [('spanish', 'fluently')]
    vcr_live_sleep(sleep_time)
    assert details.languages == [('spanish', 'fluently')]
Esempio n. 31
0
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()[:] == []
Esempio n. 32
0
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()
Esempio n. 33
0
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()
Esempio n. 34
0
def test_profile_titles():
    user = User()
    for essay_name in user.profile.essays.essay_names:
        setattr(user.profile.essays, essay_name, 'updated')

    expected_names_dict = {
        'favorites': 'Favorite books, movies, shows, music, and food',
        'friday_night': 'On a typical Friday night I am',
        'good_at': u'I\u2019m really good at',
        'message_me_if': 'You should message me if',
        'my_life': u'What I\u2019m doing with my life',
        'people_first_notice':
        ('The first things people usually notice about me'),
        'private_admission':
        (u'The most private thing I\u2019m willing to admit'),
        'self_summary': 'My self-summary',
        'six_things': 'The six things I could never do without',
        'think_about': 'I spend a lot of time thinking about'
    }

    expected_names_dict = {
        key: helpers.replace_chars(value)
        for key, value in expected_names_dict.items()
    }

    assert user.profile.essays.short_name_to_title == expected_names_dict
Esempio n. 35
0
def test_sign_detail(vcr_live_sleep):
    profile_details = User().profile.details
    profile_details.sign = None
    vcr_live_sleep(sleep_time)

    signs = ['aquarius', 'pisces', 'aries', 'taurus', 'gemini', 'cancer', 'leo',
             'virgo', 'libra', 'scorpio', 'sagittarius', 'capricorn']
    for sign in signs:
        profile_details.sign = sign
        vcr_live_sleep(sleep_time)
        assert sign in profile_details.sign.lower()
        vcr_live_sleep(sleep_time)
    profile_details.sign = 'Pisces, and it\'s fun to think about'
    vcr_live_sleep(sleep_time)
    assert 'fun' in profile_details.sign.lower()
    assert 'pisces' in profile_details.sign.lower()
Esempio n. 36
0
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
    ))
Esempio n. 37
0
def answer_all_their_questions(username):
    user = User()
    them = user.get_profile(username)

    for question in them.questions:
        if not question.answered:
            user.questions.respond(question.id, [1], [1], 3)

    questions = them.question_fetchable()[:]
    print len(questions)
    question_id_to_question = {question.id: question
                               for question in user.profile.questions}
    user.questions.clear()
    time.sleep(10)
    for question in questions:
        user.questions.respond_from_question(question,
                                             question_id_to_question, 3)
Esempio n. 38
0
def test_date_parsing_smoke():
    user = User()
    for thread in user.inbox:
        thread.datetime
        for message in thread.messages:
            message.time_sent
    for thread in user.outbox:
        thread.datetime
Esempio n. 39
0
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()[:] == []
Esempio n. 40
0
def test_nulling_of_details(vcr_live_sleep):
    details = User().profile.details
    details.ethnicities = ['white']
    vcr_live_sleep(sleep_time)
    assert 'white' in [ethnicity.lower() for ethnicity in details.ethnicities]
    vcr_live_sleep(sleep_time)
    details.ethnicities = []
    vcr_live_sleep(sleep_time)
    assert details.ethnicities == []

    details.bodytype = 'jacked'
    vcr_live_sleep(sleep_time)
    assert 'jacked' in details.bodytype.lower()
    details.bodytype = None
    vcr_live_sleep(sleep_time)
    assert not details.bodytype
    vcr_live_sleep(sleep_time)

    details.languages = [('spanish', 'fluently'), ('english', 'fluently')]
    vcr_live_sleep(sleep_time)
    assert 'spanish' in [language[0] for language in details.languages]
    # It appears that it's impossible to remove all languages.
    details.languages = [('spanish', 'fluently')]
    vcr_live_sleep(sleep_time)
    assert details.languages == [('spanish', 'fluently')]
Esempio n. 41
0
def test_children_detail(vcr_live_sleep):
    details = User().profile.details
    details.children = None
    vcr_live_sleep(sleep_time)
    assert details.children == None
    vcr_live_sleep(sleep_time)

    details.children = u"has a kid, but doesn't want more"
    vcr_live_sleep(sleep_time)
    assert details.children == u"Has a kid, but doesn't want more"
    vcr_live_sleep(sleep_time)

    kids_string = u"Doesn't have kids, and doesn't want any"
    details.children = kids_string
    vcr_live_sleep(sleep_time)
    assert details.children == kids_string
    vcr_live_sleep(sleep_time)

    kids_string = u"Doesn't have kids, but might want them"
    details.children = kids_string
    vcr_live_sleep(sleep_time)
    assert details.children == kids_string
    vcr_live_sleep(sleep_time)

    details.children = 'Has kids'
    vcr_live_sleep(sleep_time)
    assert details.children == 'Has kids'
Esempio n. 42
0
def test_sign_detail(vcr_live_sleep):
    profile_details = User().profile.details
    profile_details.sign = None
    vcr_live_sleep(sleep_time)

    signs = [
        'aquarius', 'pisces', 'aries', 'taurus', 'gemini', 'cancer', 'leo',
        'virgo', 'libra', 'scorpio', 'sagittarius', 'capricorn'
    ]
    for sign in signs:
        profile_details.sign = sign
        vcr_live_sleep(sleep_time)
        assert sign in profile_details.sign.lower()
        vcr_live_sleep(sleep_time)
    profile_details.sign = 'Pisces, and it\'s fun to think about'
    vcr_live_sleep(sleep_time)
    assert 'fun' in profile_details.sign.lower()
    assert 'pisces' in profile_details.sign.lower()
Esempio n. 43
0
def test_user_essays():
    user = User()
    first_essay = 'an essay'
    user.profile.essays.self_summary = first_essay
    assert user.profile.essays.self_summary == first_essay

    second_essay = 'next_essay'
    user.profile.essays.self_summary = second_essay

    assert user.profile.essays.self_summary == second_essay
Esempio n. 44
0
def test_job_detail(vcr_live_sleep):
    updater = details.Details.job.updater
    user = User()
    user.profile.details.job = None
    assert user.profile.details.job == None
    for pattern, value in sorted(maps.job.pattern_to_value.items()):
        user.profile.details.job = pattern
        vcr_live_sleep(sleep_time)
        assert pattern.lower() in user.profile.details.job.lower()
        assert updater('job', user.profile.details.job) == {'job': value}
Esempio n. 45
0
def test_like_functions():
    profile = User().quickmatch()
    profile.like()
    assert profile.liked
    profile.toggle_like()
    assert not profile.liked
    profile.like()
    profile.unlike()
    assert not profile.liked
    profile.unlike()
    assert not profile.liked
Esempio n. 46
0
def test_children_detail(vcr_live_sleep):
    details = User().profile.details
    details.children = None
    vcr_live_sleep(sleep_time)
    assert details.children == None
    vcr_live_sleep(sleep_time)

    details.children = u"has a kid, but doesn't want more"
    vcr_live_sleep(sleep_time)
    assert details.children == u"Has a kid, but doesn't want more"
    vcr_live_sleep(sleep_time)

    kids_string = u"Doesn't have kids, and doesn't want any"
    details.children = kids_string
    vcr_live_sleep(sleep_time)
    assert details.children == kids_string
    vcr_live_sleep(sleep_time)

    kids_string = u"Doesn't have kids, but might want them"
    details.children = kids_string
    vcr_live_sleep(sleep_time)
    assert details.children == kids_string
    vcr_live_sleep(sleep_time)

    details.children = 'Has kids'
    vcr_live_sleep(sleep_time)
    assert details.children == 'Has kids'
Esempio n. 47
0
def test_date_parsing_integration():
    user = User()
    # This test sucks, but I can't think of a better way to test this.
    # I suppose that we could just make a message element without
    # making an http request.
    this_year = datetime.date.today(
    ).year  # This is a particularly awful concession...
    assert user.inbox[0].datetime == datetime.datetime(year=this_year,
                                                       day=22,
                                                       month=10)
    assert user.inbox[0].messages[-1].time_sent == datetime.datetime(
        year=this_year, day=22, month=10)
    assert user.inbox[1].messages[-1].time_sent == datetime.datetime(
        year=this_year, day=19, month=10)
Esempio n. 48
0
def test_height_detail(vcr_live_sleep):
    user = User()
    user.profile.details.height = "5'4\""
    vcr_live_sleep(sleep_time)
    assert user.profile.details.height == u'5\' 4" (1.63m)'

    vcr_live_sleep(sleep_time)
    user.profile.details.height = u'(1.99m)'
    vcr_live_sleep(sleep_time)
    assert user.profile.details.height == u'6\' 6" (1.99m)'

    user.profile.details.height = u"5′4″"
    vcr_live_sleep(sleep_time)
    assert u'5\' 4" (1.63m)'
Esempio n. 49
0
def test_many_details_2(vcr_live_sleep):
    details = User().profile.details
    sample_details = {
        'income': 'Less than $20,000',
        'monogamy': 'Mostly monogamous',
        'pets': 'Likes dogs and has cats',
        'religion': 'Judaism, and very serious about it',
        'sign': "Pisces, and it's fun to think about",
        'children': "Doesn't have kids, but wants them",
        'drugs': 'Never'
    }
    details.convert_and_update(sample_details)
    vcr_live_sleep(sleep_time)
    for key, value in sorted(sample_details.items()):
        assert getattr(details, key) == value
Esempio n. 50
0
def test_many_details(vcr_live_sleep):
    details = User().profile.details
    sample_details = {
        'job': 'technology',
        'diet': 'Strictly Vegetarian',
        'income': 40000,
        'bodytype': 'athletic',
        'orientation': 'bisexual',
        'ethnicities': ['Asian', 'White', 'hispanic', 'black'],
        'smokes': 'when drinking',
        'drugs': 'never',
        'drinks': 'desperately',
        'education': 'Some university',
        'height': '1.52m',
        'religion': 'atheism',
        'sign': 'aries and it matters a lot',
        'status': 'single'
    }

    details.convert_and_update(sample_details)
    vcr_live_sleep(sleep_time)
Esempio n. 51
0
def test_income_detail(vcr_live_sleep):
    details = User().profile.details
    details.income = None
    vcr_live_sleep(sleep_time)
    assert details.income == None
    vcr_live_sleep(sleep_time)
    details.income = 55000
    vcr_live_sleep(sleep_time)
    assert details.income == u'$50,000-$60,000'

    details.income = u'$40,000-$50,000'
    vcr_live_sleep(sleep_time)
    assert details.income == u'$40,000-$50,000'
    vcr_live_sleep(sleep_time)

    details.income = u'More than $1,000,000'
    vcr_live_sleep(sleep_time)
    assert details.income == u'More than $1,000,000'
    vcr_live_sleep(sleep_time)

    details.income = u'Less than $20,000'
    vcr_live_sleep(sleep_time)
    assert details.income == u'Less than $20,000'
Esempio n. 52
0
def test_education_detail(vcr_live_sleep):
    details = User().profile.details
    details.education = 'Dropped out of high school'
    vcr_live_sleep(sleep_time)
    assert 'dropped out' in details.education.lower()
    vcr_live_sleep(sleep_time)
Esempio n. 53
0
def test_get_question_answer_id_calls_get_user_question(mock_get_user_question):
    user = User(mock.Mock())
    user.get_question_answer_id(mock.Mock(spec=['id']))
    assert mock_get_user_question.call_count
Esempio n. 54
0
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
Esempio n. 55
0
def test_question_filter():
    user = User()
    user_question = user.questions.somewhat_important[0]
    for profile in user.search(question=user_question)[:5]:
        question = profile.find_question(user_question.id)
        assert question.their_answer_matches
Esempio n. 56
0
def test_question_count_filter():
    user = User()
    for profile in user.search(question_count_min=250)[:5]:
        assert profile.questions[249]
Esempio n. 57
0
def test_profile_copy_smoke_test(vcr_live_sleep):
    with mock.patch('okcupyd.profile_copy.time.sleep', vcr_live_sleep):
        user = User()
        profile = get_profile_with_max_questions(user, 50)
        user.copy(profile).all()
Esempio n. 58
0
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
Esempio n. 59
0
def rate_attractive_girls():
    user = User()
    while True:
        p = user.quickmatch()
        if user.attractiveness_finder(p.username) >= 7000:
            p.rate(5)