Exemple #1
0
def calc_rating():
    occupation = request.form['occupation']
    numberOfCreditCards = int(request.form['numberofcreditcards'])

    ratingService = RatingService()
    result = ratingService.calculateCreditRating(occupation,
                                                 numberOfCreditCards)

    return render_template('result.html', rating=result)
def test_returnMinRatingOfZero():  # check for min rating
    service = RatingService()
    assert service.calculateCreditRating("Nurse") >= 0
def multipleScenarios(firstName, lastName, occupation, numOfCards,
                      expectedRating):
    service = RatingService()
    assert int(service.calculateCreditRating(occupation,
                                             numOfCards)) == expectedRating
def test_NonProfessionalMoreThanSevenCreditCardsMinusFivePoints(
):  # number of cards = 2 - experiment, check not prof job - control
    service = RatingService()
    assert service.calculateCreditRating("Not a Doctor", 9) == 15
def test_LawyerWithMoreThanSevenCreditCardsMinusFivePoints(
):  # check for number of cards - experiment, Lawyer - control
    service = RatingService()
    assert service.calculateCreditRating("Lawyer", 8) == 45
def test_doctorScores(
):  # check for Doctor - experiment, number of cards = 1 - control
    service = RatingService()
    assert service.calculateCreditRating("Doctor", 1) == 50