Exemplo n.º 1
0
def test_get_suggestions_kick(tmpdir):
    config_file = tmpdir.mkdir('test_get_suggestions').join('testfile')
    config_file.write(__config_file_score__ + '\nmin_clan_size=1')
    config = load_config_file(config_file.realpath())

    h = history.get_member_history(__fake_clan__['member_list'], None)

    members = crtools.process_members(config, __fake_clan__, __fake_warlog__,
                                      {"state": "notInWar"}, h)

    suggestions = crtools.get_suggestions(config, members, __fake_clan__)

    print(suggestions)

    assert suggestions[0].startswith('Kick')
    assert members[3]['name'] in suggestions[0]
Exemplo n.º 2
0
def test_get_suggestions_recruit(tmpdir):
    config_file = tmpdir.mkdir('test_get_suggestions').join('testfile')
    config_file.write(__config_file_score__ +
                      '\nthreshold_demote=-999999\nthreshold_promote=9999999')
    config = load_config_file(config_file.realpath())

    h = history.get_member_history(__fake_clan__['member_list'], None)

    members = crtools.process_members(config, __fake_clan__, __fake_warlog__,
                                      {"state": "notInWar"}, h)

    suggestions = crtools.get_suggestions(config, members, __fake_clan__)

    print(suggestions)

    assert len(suggestions) == 1
    assert suggestions[0] == config['strings']['suggestionRecruit']
def test_get_suggestions_kick(tmpdir):
    config_file = tmpdir.mkdir('test_get_suggestions').join('testfile')
    config_file.write(__config_file_score__ + '\nmin_clan_size=1')
    config = load_config_file(config_file.realpath())

    h = history.get_member_history(__fake_clan__.member_list, None)

    members = crtools.process_members(config, __fake_clan__, __fake_warlog__,
                                      __fake_currentwar_notinwar__, h)

    suggestions = crtools.get_suggestions(config, members,
                                          __fake_clan__.required_trophies)

    print(suggestions)

    assert suggestions[0].startswith('Kick')
    assert members[3].name in suggestions[0]
Exemplo n.º 4
0
def test_get_suggestions_promote_demote(tmpdir):
    config_file = tmpdir.mkdir('test_get_suggestions').join('testfile')
    config_file.write(__config_file_score__ + '\nthreshold_promote=10')
    config = load_config_file(config_file.realpath())

    h = history.get_member_history(__fake_clan__['member_list'], None)

    members = crtools.process_members(config, __fake_clan__, __fake_warlog__,
                                      {"state": "notInWar"}, h)

    suggestions = crtools.get_suggestions(config, members, __fake_clan__)

    print(suggestions)

    assert suggestions[0].startswith('Demote')
    assert members[2]['name'] in suggestions[0]
    assert suggestions[1].startswith('Promote') or suggestions[2].startswith(
        'Promote')
    assert members[4]['name'] in suggestions[1] or members[4][
        'name'] in suggestions[2]
def test_get_suggestions_promote_demote(tmpdir):
    config_file = tmpdir.mkdir('test_get_suggestions').join('testfile')
    config_file.write(__config_file_score__ + '\nthreshold_promote=10')
    config = load_config_file(config_file.realpath())

    h = history.get_member_history(__fake_clan__.member_list, None)

    members = crtools.process_members(config, __fake_clan__, __fake_warlog__,
                                      __fake_currentwar_notinwar__, h)

    suggestions = crtools.get_suggestions(config, members,
                                          __fake_clan__.required_trophies)

    print(suggestions)

    assert suggestions[0].startswith('Demote')
    assert members[2].name in suggestions[0]
    assert suggestions[1].startswith('Promote') or suggestions[2].startswith(
        'Promote')
    assert members[4].name in suggestions[1] or members[4].name in suggestions[
        2]