Example #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'])
Example #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'
Example #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
Example #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)
Example #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')
Example #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])
Example #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])
Example #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'])
Example #9
0
def test_is_valid(data):
    assert all(CreditCard(card['name'], code=card['code']).is_valid for card in data)
Example #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)