Exemplo n.º 1
0
 def test_returns_does_not_exception_with_missing_gross_rate_of_pay(self, mock_cabinet):
     mock_cabinet.get_claim.return_value = (
         {'glross_rate_of_pay': '650'},
         {'employee_basic_weekly_pay': '650'}
     )
     claim_id = 1
     discrepancies = find_discrepancies(claim_id)
Exemplo n.º 2
0
def wage_details_discrepancies():
    existing_form = session.get('wage_details')
    if existing_form:
        form = ClaimantWageDetails(**existing_form)
    else:
        form = ClaimantWageDetails()

    claim_id = session.get('claim_id')

    if form.validate_on_submit():
        session['wage_details'] = form.data
        if claim_id:
            claim_service.add_details_to_claim(claim_id, form.data)
        return redirect(url_for('wages_owed'))
    elif request.method == 'POST' and not form.validate():
        session['wage_details'] = form.data
        return redirect(url_for('wage_details', data=form.data), code=307)

    discrepancies = {}
    if claim_id:
        discrepancies = claim_service.find_discrepancies(claim_id)
    return render_template('wage_details.html',
                           form=form,
                           nav_links=nav_links(),
                           discrepancies=discrepancies)
Exemplo n.º 3
0
def summary():
    discrepancies = {}

    claim_id = session.get('claim_id')
    if claim_id:
        discrepancies = claim_service.find_discrepancies(claim_id)

    return render_template('summary.html', discrepancies=discrepancies, nav_links=nav_links(), claim_id=claim_id)
    def test_updating_claim_information(self):
        personal_details = {'nino': 'XX223344X'}
        claimant_details = {'gross_rate_of_pay': '11.0'}
        claimant_details_updated = {
            'gross_rate_of_pay': '12.0',
        }

        claim_id = api.create_claim_2(personal_details)
        api.add_details_to_claim(claim_id, claimant_details)

        assert_that(api.find_discrepancies(claim_id),
                    has_entry('gross_rate_of_pay', ('11.0', '300.5')))

        api.add_details_to_claim(claim_id, claimant_details_updated)

        assert_that(api.find_discrepancies(claim_id),
                    has_entry('gross_rate_of_pay', ('12.0', '300.5')))
    def test_updating_claim_information(self):
        personal_details = {'nino': 'XX223344X'}
        claimant_details = {'gross_rate_of_pay': '11.0'}
        claimant_details_updated = {
            'gross_rate_of_pay': '12.0',
        }

        claim_id = api.create_claim_2(personal_details)
        api.add_details_to_claim(claim_id, claimant_details)

        assert_that(api.find_discrepancies(claim_id),
            has_entry('gross_rate_of_pay', ('11.0', '300.5')))

        api.add_details_to_claim(claim_id, claimant_details_updated)

        assert_that(api.find_discrepancies(claim_id),
            has_entry('gross_rate_of_pay', ('12.0', '300.5')))
Exemplo n.º 6
0
    def test_returns_no_discrepancies_for_matching_data(self, mock_cabinet):
        mock_cabinet.get_claim.return_value = (
            {'gross_rate_of_pay': '650'},
            {'employee_basic_weekly_pay': '650'}
        )
        claim_id = 1

        discrepancies = find_discrepancies(claim_id)
        assert_that(discrepancies, has_length(0))
    def test_creating_updating_and_finding_discrepancies_on_a_claim(self):
        personal_details = {'nino': 'XX223344X'}
        claimant_details = {'gross_rate_of_pay': '11.0'}

        claim_id = api.create_claim_2(personal_details)
        api.add_details_to_claim(claim_id, claimant_details)
        discrepancies = api.find_discrepancies(claim_id)
        assert_that(discrepancies,
                    has_entry('gross_rate_of_pay', ('11.0', '300.5')))
    def test_creating_updating_and_finding_multiple_discrepancies(self):
        personal_details = {'nino': 'XX223344X'}
        claimant_details = {'gross_rate_of_pay': '11.0'}
        updated_claimant_details = {'gross_amount_owed': '12.0'}

        claim_id = api.create_claim_2(personal_details)
        api.add_details_to_claim(claim_id, claimant_details)
        api.add_details_to_claim(claim_id, updated_claimant_details)
        discrepancies = api.find_discrepancies(claim_id)
        assert_that(discrepancies, has_length(2))
Exemplo n.º 9
0
    def test_returns_values_of_discrepant_wage_details(self, mock_cabinet):
        mock_cabinet.get_claim.return_value = (
            {'gross_rate_of_pay': '600'},
            {'employee_basic_weekly_pay': '650'}
        )
        claim_id = 1

        discrepancies = find_discrepancies(claim_id)
        assert_that(discrepancies, has_length(1))
        assert_that(discrepancies, has_entry('gross_rate_of_pay', ('600','650')))
Exemplo n.º 10
0
def summary():
    discrepancies = {}

    claim_id = session.get('claim_id')
    if claim_id:
        discrepancies = claim_service.find_discrepancies(claim_id)

    return render_template('summary.html',
                           discrepancies=discrepancies,
                           nav_links=nav_links(),
                           claim_id=claim_id)
    def test_creating_updating_and_finding_discrepancies_on_a_claim(self):
        personal_details = {
            'nino': 'XX223344X'
        }
        claimant_details = {
            'gross_rate_of_pay': '11.0'
        }

        claim_id = api.create_claim_2(personal_details)
        api.add_details_to_claim(claim_id, claimant_details)
        discrepancies = api.find_discrepancies(claim_id)
        assert_that(discrepancies, has_entry('gross_rate_of_pay', ('11.0', '300.5')))
Exemplo n.º 12
0
    def test_returns_values_for_multiple_discrepancies(self, mock_cabinet):
        mock_cabinet.get_claim.return_value = (
            {'gross_rate_of_pay': '600',
             'gross_amount_owed': '500'},
            {'employee_basic_weekly_pay': '650',
             'employee_owed_wages_in_arrears': '700'}
        )
        claim_id = 1

        discrepancies = find_discrepancies(claim_id)
        assert_that(discrepancies, has_length(2))
        assert_that(discrepancies, has_entry('gross_rate_of_pay', ('600','650')))
        assert_that(discrepancies, has_entry('gross_amount_owed', ('500','700')))
    def test_creating_updating_and_finding_multiple_discrepancies(self):
        personal_details = {
            'nino': 'XX223344X'
        }
        claimant_details = {
            'gross_rate_of_pay': '11.0'
        }
        updated_claimant_details = {
            'gross_amount_owed': '12.0'
        }

        claim_id = api.create_claim_2(personal_details)
        api.add_details_to_claim(claim_id, claimant_details)
        api.add_details_to_claim(claim_id, updated_claimant_details)
        discrepancies = api.find_discrepancies(claim_id)
        assert_that(discrepancies, has_length(2))
Exemplo n.º 14
0
def wages_owed():
    existing_form = session.get('wages_owed')

    if existing_form:
        form = WagesOwed(**existing_form)
    else:
        form = WagesOwed()

    if form.validate_on_submit():
        session['wages_owed'] = form.data
        claim_id = session.get('claim_id')
        if claim_id:
            claim_service.add_details_to_claim(claim_id, form.data)
            discrepancies = claim_service.find_discrepancies(claim_id)
            if 'gross_amount_owed' in discrepancies:
                return redirect(url_for('arrears_pay_discrepancies'))
        return redirect(url_for('summary'))

    return render_template('wages_owed.html', form=form, nav_links=nav_links(),
            discrepancies={})
Exemplo n.º 15
0
def wage_details():
    existing_form = session.get('wage_details')

    if existing_form:
        existing_form['gross_rate_of_pay'] = session.get('gross_rate_of_pay')
        form = ClaimantWageDetails(**existing_form)
    else:
        form = ClaimantWageDetails(gross_rate_of_pay=session.get('gross_rate_of_pay'))

    if form.validate_on_submit():
        session['wage_details'] = form.data
        claim_id = session.get('claim_id')
        if claim_id:
            claim_service.add_details_to_claim(claim_id, form.data)
            discrepancies = claim_service.find_discrepancies(claim_id)
            if 'gross_rate_of_pay' in discrepancies:
                return redirect(url_for('wage_details_discrepancies'))
        return redirect(url_for('wages_owed'))

    return render_template('wage_details.html', form=form, nav_links=nav_links(),
            discrepancies={})
Exemplo n.º 16
0
def arrears_pay_discrepancies():
    existing_form = session.get('wages_owed')

    if existing_form:
        form = WagesOwed(**existing_form)
    else:
        form = WagesOwed()

    claim_id = session.get('claim_id')
    if form.validate_on_submit():
        session['wages_owed'] = form.data
        if claim_id:
            claim_service.add_details_to_claim(claim_id, form.data)
        return redirect(url_for('summary'))
    elif request.method == 'POST' and not form.validate():
        session['wages_owed'] = form.data
        return redirect(url_for('wages_owed', data=form.data), code=307)

    discrepancies = {}
    if claim_id:
        discrepancies = claim_service.find_discrepancies(claim_id)
    return render_template('wages_owed.html', form=form, nav_links=nav_links(), discrepancies=discrepancies)
Exemplo n.º 17
0
def wages_owed():
    existing_form = session.get('wages_owed')

    if existing_form:
        form = WagesOwed(**existing_form)
    else:
        form = WagesOwed()

    if form.validate_on_submit():
        session['wages_owed'] = form.data
        claim_id = session.get('claim_id')
        if claim_id:
            claim_service.add_details_to_claim(claim_id, form.data)
            discrepancies = claim_service.find_discrepancies(claim_id)
            if 'gross_amount_owed' in discrepancies:
                return redirect(url_for('arrears_pay_discrepancies'))
        return redirect(url_for('summary'))

    return render_template('wages_owed.html',
                           form=form,
                           nav_links=nav_links(),
                           discrepancies={})
Exemplo n.º 18
0
def wage_details():
    existing_form = session.get('wage_details')

    if existing_form:
        existing_form['gross_rate_of_pay'] = session.get('gross_rate_of_pay')
        form = ClaimantWageDetails(**existing_form)
    else:
        form = ClaimantWageDetails(
            gross_rate_of_pay=session.get('gross_rate_of_pay'))

    if form.validate_on_submit():
        session['wage_details'] = form.data
        claim_id = session.get('claim_id')
        if claim_id:
            claim_service.add_details_to_claim(claim_id, form.data)
            discrepancies = claim_service.find_discrepancies(claim_id)
            if 'gross_rate_of_pay' in discrepancies:
                return redirect(url_for('wage_details_discrepancies'))
        return redirect(url_for('wages_owed'))

    return render_template('wage_details.html',
                           form=form,
                           nav_links=nav_links(),
                           discrepancies={})