コード例 #1
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)
    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))
コード例 #4
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')))
コード例 #5
0
 def test_add_details_to_claim(self, mock_cabinet):
     mock_cabinet.get_claim.return_value = ({'a': '_'}, {'b': '_'})
     claim_id = 12
     claimant_details = {'a': 'b'}
     claim = add_details_to_claim(claim_id, claimant_details)
     mock_cabinet.update_claim.assert_called_with(
         claim_id, claimant_information=claimant_details)
コード例 #6
0
    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))
コード例 #7
0
    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')))
コード例 #9
0
 def test_add_details_to_claim(self, mock_cabinet):
     mock_cabinet.get_claim.return_value = ({'a': '_'},{'b': '_'})
     claim_id = 12
     claimant_details = {'a': 'b'}
     claim = add_details_to_claim(claim_id, claimant_details)
     mock_cabinet.update_claim.assert_called_with(
         claim_id,
         claimant_information=claimant_details
     )
コード例 #10
0
ファイル: routes.py プロジェクト: InsolvencyService/rps-alpha
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={})
コード例 #11
0
ファイル: routes.py プロジェクト: InsolvencyService/rps-alpha
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={})
コード例 #12
0
ファイル: routes.py プロジェクト: InsolvencyService/rps-alpha
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)
コード例 #13
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={})
コード例 #14
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={})