示例#1
0
def test_items_estimated_ilvl_non_default(default_items_response):
    jack = Character('jack')
    for i, item in enumerate(
            default_items_response['equipment']['equipped_items']):
        item['level']['value'] = 405 + i

    Section.items(jack, default_items_response, None)
    assert jack.estimated_ilvl == 412.5
示例#2
0
def test_items_all_items(default_items_response):
    jack = Character('jack')
    Section.items(jack, default_items_response, None)
    for i, slot in enumerate(ITEM_SLOTS):
        assert getattr(jack, '{}_itemLevel'.format(slot)) == 405
        assert getattr(jack, '{}_id'.format(slot)) == 165822 + i
        assert getattr(jack,
                       '{}_name'.format(slot)) == 'Cowl of Tideborne Omens'
        assert getattr(jack, '{}_quality'.format(slot)) == 'Epic'
示例#3
0
def test_items_missing_name_value_is_None(default_items_response):
    jack = Character('jack')
    del default_items_response['equipment']['equipped_items'][0]['name']

    Section.items(jack, default_items_response, None)
    assert jack.head_itemLevel == 405
    assert jack.head_id == 165822
    assert jack.head_name == None
    assert jack.head_quality == 'Epic'
示例#4
0
def test_items_missing_id_value_is_None(default_items_response):
    jack = Character('jack')
    del default_items_response['equipment']['equipped_items'][0]['item']['id']

    Section.items(jack, default_items_response, None)
    assert jack.head_itemLevel == 405
    assert jack.head_id == None
    assert jack.head_name == 'Cowl of Tideborne Omens'
    assert jack.head_quality == 'Epic'
示例#5
0
def test_items_missing_ilevel_is_None(default_items_response):
    jack = Character('jack')
    del default_items_response['equipment']['equipped_items'][0]['level']

    Section.items(jack, default_items_response, None)
    assert jack.head_itemLevel == None
    assert jack.head_id == 165822
    assert jack.head_name == 'Cowl of Tideborne Omens'
    assert jack.head_quality == 'Epic'
    assert jack.estimated_ilvl == 379.6875
示例#6
0
def test_items_estimated_ilvl_missing_offhand_is_weapon(
        default_items_response, mock_is_off_hand_weapon):
    jack = Character('jack')
    default_items_response['equipment']['equipped_items'].remove(
        next(item
             for item in default_items_response['equipment']['equipped_items']
             if item['slot']['type'] == 'OFF_HAND'))
    mock_is_off_hand_weapon.return_value = True

    Section.items(jack, default_items_response, None)
    assert jack.estimated_ilvl == 379.6875
示例#7
0
def test_items_missing_item(default_items_response):
    jack = Character('jack')
    default_items_response['equipment']['equipped_items'].remove(
        next(item
             for item in default_items_response['equipment']['equipped_items']
             if item['slot']['type'] == 'FINGER_1'))

    Section.items(jack, default_items_response, None)
    assert jack.finger_1_itemLevel == None
    assert jack.finger_1_id == None
    assert jack.finger_1_name == None
    assert jack.finger_1_quality == None
示例#8
0
def test_item_gets_removed(default_items_response, mock_is_off_hand_weapon):
    jack = Character('jack')

    Section.items(jack, default_items_response, None)
    assert jack.off_hand_itemLevel == 405

    off_hand = default_items_response['equipment']['equipped_items'][15]
    default_items_response['equipment']['equipped_items'].remove(
        next(item
             for item in default_items_response['equipment']['equipped_items']
             if item['slot']['type'] == 'OFF_HAND'))
    mock_is_off_hand_weapon.return_value = False

    Section.items(jack, default_items_response, None)
    assert jack.off_hand_itemLevel == None
示例#9
0
def test_tabard_ignored(default_items_response):
    jack = Character('jack')
    default_items_response['equipment']['equipped_items'].append({
        'slot': {
            'type': 'TABARD'
        },
        'level': {
            'value': 1
        },
        'item': {
            'id': 45585
        },
        'name': 'Silvermoon City Tabard',
        'quality': {
            'name': 'UNCOMMON'
        }
    })

    Section.items(jack, default_items_response, None)
    assert jack.estimated_ilvl == 405
示例#10
0
def test_items_estimated_ilvl_missing_is_zero(default_items_response):
    jack = Character('jack')
    del default_items_response['equipment']['equipped_items'][0]

    Section.items(jack, default_items_response, None)
    assert jack.estimated_ilvl == 379.6875
示例#11
0
def test_items_estimated_ilvl_default(default_items_response):
    jack = Character('jack')
    Section.items(jack, default_items_response, None)
    assert jack.estimated_ilvl == 405