def test_add_failed_questions_incomplete_declaration():
    failed_questions_adder = export_g8_suppliers.add_failed_questions(None)

    record = failed_questions_adder({'declaration': {'status': 'started'}})

    assert record['failed_mandatory'] == ['INCOMPLETE']
    assert record['discretionary'] == []
def test_add_failed_question_mandatory_false_is_true(get_declaration_questions):
    get_declaration_questions.return_value = [
        (Mock(id='termsAndConditions', number=1), False)
    ]

    failed_questions_adder = export_g8_suppliers.add_failed_questions(None)

    record = failed_questions_adder({'declaration': {'status': 'complete'}})
    assert record['failed_mandatory'] == ['Q1 - termsAndConditions']
def test_add_failed_question_yes_or_na(get_declaration_questions):
    get_declaration_questions.return_value = [
        (Mock(id='employersInsurance', number=14), "Invalid")
    ]

    failed_questions_adder = export_g8_suppliers.add_failed_questions(None)

    record = failed_questions_adder({'declaration': {'status': 'complete'}})

    assert record['failed_mandatory'] == ['Q14 - employersInsurance']
def test_add_failed_question_mandatory_true_is_false(get_declaration_questions):
    get_declaration_questions.return_value = [
        (Mock(id='terrorism', number=17), True)
    ]

    failed_questions_adder = export_g8_suppliers.add_failed_questions(None)

    record = failed_questions_adder({'declaration': {'status': 'complete'}})

    assert record['failed_mandatory'] == ['Q17 - terrorism']