Esempio n. 1
0
def test_cardholder(data):
    cards = [
        CreditCard(card['name'], code=card['code'], cardholder='TESTE DADOS')
        for card in data
    ]
    assert len(cards) == len(
        [card for card in cards if card.cardholder == 'TESTE DADOS'])
Esempio n. 2
0
def test_code_name(data):
    card = [
        CreditCard(card['name'],
                   code=card['code'],
                   expire_month='7',
                   expire_year='2016') for card in data
    ][0]
    assert card.code_name == 'CVV'
Esempio n. 3
0
def test_is_not_expired(data):
    card = [
        CreditCard(card['name'],
                   code=card['code'],
                   expire_month='7',
                   expire_year='2021') for card in data
    ][0]
    assert not card.is_expired
Esempio n. 4
0
def test_expires(data):
    cards = [
        CreditCard(card['name'],
                   code=card['code'],
                   expire_month='7',
                   expire_year='2021') for card in data
    ]
    assert all(True for c in cards if type(c.expires) == datetime)
Esempio n. 5
0
def test_expires_string(data):
    cards = [
        CreditCard(card['name'],
                   code=card['code'],
                   expire_month='7',
                   expire_year='2021') for card in data
    ]
    assert all(True for c in cards if c.expires_string == '07/21') and any(
        True for c in cards if c.expires_string == '07/21')
Esempio n. 6
0
def test_code(data):
    codes = [card['code'] for card in data]
    cards = [CreditCard(card['name'], code=card['code']) for card in data]
    assert all([True for c in cards if c.code in codes]) and any([True for c in cards if c.code in codes])
Esempio n. 7
0
def test_number(data):
    numbers = [card['name'] for card in data]
    cards = [CreditCard(card['name'], code=card['code']) for card in data]
    assert all([True for c in cards if c.number in numbers]) and any([True for c in cards if c.number in numbers])
Esempio n. 8
0
def test_brand(data):
    cards = [CreditCard(card['name'], code=card['code']) for card in data]
    assert len(cards) == len([card for card in cards if card.brand == 'Visa'])
Esempio n. 9
0
def test_is_valid(data):
    assert all(CreditCard(card['name'], code=card['code']).is_valid for card in data)
Esempio n. 10
0
def test_init(data):
    assert len(data) > 0
    cards = [CreditCard(card['name'], code=card['code']) for card in data]
    assert len(cards) == len(data)