Exemple #1
0
def test_send_war_nag_participants_completed_returns_false_because_url_invalid(
        tmpdir):

    config_file = tmpdir.mkdir(
        'test_send_war_nag_threshold_not_met_returns_true').join('testfile')
    config_file.write(__config_file__)
    config = load_config_file(config_file.realpath())

    fake_current_war = pyroyale.WarCurrent(
        state='collectionDay',
        collection_end_time=datetime.utcnow().strftime("%Y%m%dT%H%M%S.xxxx"),
        participants=[
            pyroyale.WarParticipant(name='AAA',
                                    tag='#AAA',
                                    battles_played=1,
                                    number_of_battles=3),
            pyroyale.WarParticipant(name='BBB',
                                    tag='#BBB',
                                    battles_played=1,
                                    number_of_battles=3)
        ])

    fake_members = [pyroyale.WarParticipant(tag='#AAA')]

    assert discord.send_war_nag(config, fake_current_war,
                                fake_members) == False
Exemple #2
0
                {
                    "event": "join",
                    "status": "new",
                    "role": "member",
                    "date": 0
                }
            ]
        }

    }
}

__fake_currentwar__ = ProcessedCurrentWar(config=load_config_file(False), current_war=pyroyale.WarCurrent(
        state               = 'collectionDay',
        collection_end_time = '20190209T212846.354Z',
        participants        = [pyroyale.WarParticipant(tag='#AAAAAA', cards_earned=0)]
    ))

def test_get_role_change_status():
    assert history.get_role_change_status('foo',                 'foo')                 == False
    assert history.get_role_change_status('foo',                 'bar')                 == False
    assert history.get_role_change_status('foo',                 history.ROLE_MEMBER)   == False
    assert history.get_role_change_status(history.ROLE_MEMBER,   'foo')                 == False
    assert history.get_role_change_status('foo',                 'foo')                 == False
    assert history.get_role_change_status(history.ROLE_LEADER,   history.ROLE_LEADER)   == 'unchanged'
    assert history.get_role_change_status(history.ROLE_LEADER,   history.ROLE_COLEADER) == 'demotion'
    assert history.get_role_change_status(history.ROLE_LEADER,   history.ROLE_ELDER)    == 'demotion'
    assert history.get_role_change_status(history.ROLE_LEADER,   history.ROLE_MEMBER)   == 'demotion'
    assert history.get_role_change_status(history.ROLE_COLEADER, history.ROLE_COLEADER) == 'unchanged'
    assert history.get_role_change_status(history.ROLE_COLEADER, history.ROLE_LEADER)   == 'promotion'
    assert history.get_role_change_status(history.ROLE_COLEADER, history.ROLE_ELDER)    == 'demotion'
                            arena=pyroyale.Arena(id=54000008, name='Arena 7'),
                            last_seen="20190802T154619.000Z"),
        pyroyale.ClanMember(tag="#EEEEEE",
                            name="MemberPersonToBePromoted",
                            role="member",
                            exp_level=8,
                            trophies=3144,
                            donations=100000000,
                            arena=pyroyale.Arena(id=54000008, name='Arena 7'),
                            last_seen="20190802T154619.000Z")
    ])

__fake_war_participants__ = [
    pyroyale.WarParticipant(tag='#AAAAAA',
                            cards_earned=1120,
                            battles_played=1,
                            wins=1,
                            number_of_battles=1,
                            collection_day_battles_played=3),
    pyroyale.WarParticipant(tag='#BBBBBB',
                            cards_earned=1120,
                            battles_played=1,
                            wins=1,
                            number_of_battles=1,
                            collection_day_battles_played=1),
    pyroyale.WarParticipant(tag='#CCCCCC',
                            cards_earned=1120,
                            battles_played=1,
                            wins=1,
                            number_of_battles=1,
                            collection_day_battles_played=1),
    pyroyale.WarParticipant(tag='#DDDDDD',