Example #1
0
def test_donor_exists():
    """ Verify the return value for an existing donor using the default list by checking if the return value is a list
    and the list contains the object related to the donor """
    donors = Donors()
    result = donors.donor_exists("Neymar")

    assert isinstance(result, list)
    assert result[0].name == "Neymar"
Example #2
0
def test_donor_doesnt_exists():
    """ Verify the return value for a non-existing donor using the default list by checking if the return value is an
    empty list """
    donors = Donors()
    result = donors.donor_exists("Bob")

    assert isinstance(result, list)
    with pytest.raises(IndexError):
        result[0]
def test_collection_donor_exists():
    donors = DonorCollection()
    donors.add(Donor('Test1', [10]))
    donors.add(Donor('Test2', [27]))
    assert donors.donor_exists('Test1')
    assert donors.donor_exists('Test2')
Example #4
0
def test_donor_exists():
    donor_collection = DC()
    donor_collection.add_donor("Jimmy Johns", 100)
    assert donor_collection.donor_exists('Jimmy Johns') is True
    assert donor_collection.donor_exists('Dummy name1') is False
    assert donor_collection.donor_exists('Dummy name2') is False
Example #5
0
def test_add_donor():
    donor_collection = DC()
    donor_collection.add_donor("Jimmy Johns", 100)
    assert donor_collection.donor_exists("Jimmy Johns") is True