Exemplo n.º 1
0
    def test_update_md_clauses_with_lender_reference_name_but_no_reference(
            self, mock_query):
        # The mortgage doc has a reference specified - but the function receives NO reference.
        # As a result, NO reference should appear in the outputted deed.

        mock_query_response = mock_query.filter_by.return_value
        mock_query_response.first.return_value = MortgageDocMockWithReference()

        mock_dict = {}

        self.assertEqual(
            update_md_clauses(mock_dict, "e-MDTest", "", "", "", "Fake Org"),
            True)

        md_dict = json.loads(MortgageDocMockWithReference.data)

        expected_dict = {
            'charge_clause':
            md_dict['charge_clause'],
            'additional_provisions':
            md_dict['additional_provisions'],
            'lender':
            md_dict['lender'],
            'effective_clause':
            'This charge takes effect when the registrar' +
            ' receives notification from Fake Org that the charge' +
            ' is to take effect.'
        }

        self.assertEquals(mock_dict, expected_dict)
Exemplo n.º 2
0
    def test_update_md_clauses_with_date_of_mortgage_offer_heading_but_no_info_from_deed(
            self, mock_query):
        # The mortgage doc includes the mortgage date offer - but no mortgage date offer is provided to the function.
        # As a result, mortgage document offer date should NOT appear in the outputted deed.
        mock_query_response = mock_query.filter_by.return_value
        mock_query_response.first.return_value = MortgageDocMockWithReference()

        mock_dict = {}

        self.assertEqual(
            update_md_clauses(mock_dict, "e-MDTest", "", "", "", "Fake Org"),
            True)

        md_dict = json.loads(MortgageDocMockWithDateOfMortgageOffer.data)

        expected_dict = {
            'charge_clause':
            md_dict['charge_clause'],
            'additional_provisions':
            md_dict['additional_provisions'],
            'lender':
            md_dict['lender'],
            'effective_clause':
            'This charge takes effect when the registrar' +
            ' receives notification from Fake Org that the charge' +
            ' is to take effect.'
        }

        self.assertEquals(mock_dict, expected_dict)
Exemplo n.º 3
0
    def test_update_md_clauses_deed_effector(self, mock_query):
        mock_query_response = mock_query.filter_by.return_value
        mock_query_response.first.return_value = MortgageDocMockWithDeedEffector(
        )

        mock_dict = {}

        self.assertEqual(
            update_md_clauses(mock_dict, "e-MDTest", "", "", "Different Name",
                              "Fake Org"), True)

        md_dict = json.loads(MortgageDocMockWithDeedEffector.data)

        expected_dict = {
            'charge_clause':
            md_dict['charge_clause'],
            'additional_provisions':
            md_dict['additional_provisions'],
            'lender':
            md_dict['lender'],
            'effective_clause':
            'This charge takes effect when the registrar' +
            ' receives notification from Different Name that the charge' +
            ' is to take effect.'
        }

        self.assertEquals(mock_dict, expected_dict)
Exemplo n.º 4
0
    def test_update_md_clauses_no_deed_result(self, mock_query):

        mock_query_response = mock_query.filter_by.return_value
        mock_query_response.first.return_value = None

        self.assertEqual(
            update_md_clauses(None, "e-MDTest", "RefTest", "", "", "Fake Org"),
            False)