Example #1
0
    def test_presenter_formats_data_correctly(self):
        presenter = mobile_phone_mast_info_presenters.FullMastInfoPresenter([
            mobile_phone_mast_repository.MobilePhoneMastInfo(
                SharedTestData.CSV_DATA),
            mobile_phone_mast_repository.MobilePhoneMastInfo(
                SharedTestData.CSV_DATA)
        ])

        expected_output = '\n\n'.join([
            TestMastInfoPresenter.SINGLE_PHONE_MAST_INFO_ITEM,
            TestMastInfoPresenter.SINGLE_PHONE_MAST_INFO_ITEM
        ])

        actual_output = presenter.output_mast_info_items()
        self.assertEqual(actual_output, expected_output)
Example #2
0
    def test_presenter_correctly_appends_rent(self):

        mast_info_items = [
            mobile_phone_mast_repository.MobilePhoneMastInfo(
                SharedTestData.CSV_DATA),
            mobile_phone_mast_repository.MobilePhoneMastInfo(
                SharedTestData.CSV_DATA)
        ]

        mock_presenter = mock.MagicMock()
        mock_presenter.output_mast_info_items.return_value = ""

        presenter = mobile_phone_mast_info_presenters.TalliedRentPesenterDecorator(
            mock_presenter, mast_info_items)

        expected_output = "\n\n[TOTAL RENT]: 25500.00"
        actual_output = presenter.output_mast_info_items()
        self.assertEquals(actual_output, expected_output)
Example #3
0
    def test_presenter_formats_date_when_format_is_supplied(self):
        mast_info_list = [
            mobile_phone_mast_repository.MobilePhoneMastInfo(
                SharedTestData.CSV_DATA)
        ]

        presenter = mobile_phone_mast_info_presenters.FullMastInfoPresenter(
            mast_info_list, date_format="%d/%m/%Y")

        expected_output = TestMastInfoPresenter.SINGLE_PHONE_MAST_INFO_ITEM_WITH_FORMATTED_DATE
        actual_output = presenter.output_mast_info_items()
        self.assertEqual(actual_output, expected_output)
Example #4
0
 def __mock_mast_with_dict(
         self, dict) -> mobile_phone_mast_repository.MobilePhoneMastInfo:
     return mobile_phone_mast_repository.MobilePhoneMastInfo(dict)
Example #5
0
 def __mock_mast_with_tenant_name(
         self, tenant_name: str
 ) -> mobile_phone_mast_repository.MobilePhoneMastInfo:
     return mobile_phone_mast_repository.MobilePhoneMastInfo(
         {'Tenant Name': tenant_name})
Example #6
0
 def __mock_mast_with_lease_years(
         self, lease_years: int
 ) -> mobile_phone_mast_repository.MobilePhoneMastInfo:
     return mobile_phone_mast_repository.MobilePhoneMastInfo(
         {'Lease Years': lease_years})
Example #7
0
 def __mock_mast_with_rent(
         self,
         rent: int) -> mobile_phone_mast_repository.MobilePhoneMastInfo:
     return mobile_phone_mast_repository.MobilePhoneMastInfo(
         {'Current Rent': rent})
Example #8
0
 def __create_mast_with_lease_start_date(
     self, lease_start_date: str
 ) -> mobile_phone_mast_repository.MobilePhoneMastInfo:
     return mobile_phone_mast_repository.MobilePhoneMastInfo(
         {'Lease Start Date': lease_start_date})