Пример #1
0
def id(id):
    """
    Updates one guild specified by guild id.
        :param id: guild_id
    """
    guildId(id)
    return jsonify({'result': 'ok'})
def test_guildId_ok(mGObj, mQ):
    mQ.get.return_value = 'ok'
    assert guildId(1) == 'ok'
    mGObj.assert_called_once()
    mGObj.assert_called_with('ok', False, False)
    mGObj.reset_mock()
    assert guildId(1, True, True) == 'ok'
    mGObj.assert_called_once()
    mGObj.assert_called_with('ok', True, True)
Пример #3
0
def current(id):
    """
    Returns donations from dawn of time up until now.
        :param id: guild_id
    """
    data = guildId(id, True, True)
    return jsonify(playerDonationMatch(data['timeStamp']))
def differenceNow(id1, id2):
    """
    Returns donations from given time up until now.
        :param id1: guild_id
        :param id2: timestamp_id
    """
    timeStamp2 = TimeStamp.query.get(id2)

    if timeStamp2 is None:
        raise DbException(404, 'Timestamp was not found.', ['timestamp_id'])

    if timeStamp2.guild_id != id1:
        raise DbException(400, 'Id mismatch', ['guild_id', 'timestamp_id'])

    timeStamp1 = guildId(id1, True, True)['timeStamp']

    return jsonify(playerDonDiffMatch(timeStamp1, timeStamp2))
def test_guildId_nok(mGObj, mQ):
    mQ.get.return_value = None
    with pytest.raises(DbException):
        guildId(1)
        assert False