Esempio n. 1
0
    def testParseStateBond(self) -> None:
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(
            status="ACTIVE",
            bond_type="CASH",
            state_bond_id="BOND_ID",
            date_paid="1/2/2111",
            state_code="us_nd",
            county_code="BISMARCK",
            bond_agent="AGENT",
            amount="$125.00",
        )

        # Act
        result = state_bond.convert(ingest_bond, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StateBond(
            status=BondStatus.SET,
            status_raw_text="ACTIVE",
            bond_type=BondType.CASH,
            bond_type_raw_text="CASH",
            external_id="BOND_ID",
            date_paid=date(year=2111, month=1, day=2),
            state_code="US_ND",
            county_code="BISMARCK",
            bond_agent="AGENT",
            amount_dollars=125,
        )

        self.assertEqual(result, expected_result)
    def testParseStateBond(self):
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(
            status='ACTIVE',
            bond_type='CASH',
            state_bond_id='BOND_ID',
            date_paid='1/2/2111',
            state_code='us_nd',
            county_code='BISMARCK',
            bond_agent='AGENT',
            amount='$125.00',
        )

        # Act
        result = state_bond.convert(ingest_bond, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StateBond(
            status=BondStatus.SET,
            status_raw_text='ACTIVE',
            bond_type=BondType.CASH,
            bond_type_raw_text='CASH',
            external_id='BOND_ID',
            date_paid=date(year=2111, month=1, day=2),
            state_code='US_ND',
            county_code='BISMARCK',
            bond_agent='AGENT',
            amount_dollars=125,
        )

        self.assertEqual(result, expected_result)
    def testParseBond_AmountIsBondDenied_UsesAmountAsType(self):
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(amount='Bond Denied')

        # Act
        result = state_bond.convert(ingest_bond, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StateBond.new_with_defaults(
            bond_type=BondType.DENIED, status=BondStatus.SET)
        self.assertEqual(result, expected_result)
    def testParseBond_OnlyAmount_InfersCash(self):
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(amount='1,500')

        # Act
        result = state_bond.convert(ingest_bond, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StateBond.new_with_defaults(
            bond_type=BondType.CASH,
            status=BondStatus.PRESENT_WITHOUT_INFO,
            amount_dollars=1500)
        self.assertEqual(result, expected_result)
Esempio n. 5
0
    def testParseBond_AmountIsNoBond_UsesAmountAsType(self) -> None:
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(state_code="us_xx",
                                                amount="No Bond")

        # Act
        result = state_bond.convert(ingest_bond, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StateBond.new_with_defaults(
            state_code="US_XX",
            bond_type=BondType.DENIED,
            status=BondStatus.SET)
        self.assertEqual(result, expected_result)
    def testParseBond_MapStatusToType(self):
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(bond_type='bond revoked')
        overrides_builder = EnumOverrides.Builder()
        overrides_builder.add('BOND REVOKED', BondStatus.REVOKED, BondType)
        overrides = overrides_builder.build()

        # Act
        result = state_bond.convert(
            ingest_bond, attr.evolve(_EMPTY_METADATA,
                                     enum_overrides=overrides))

        # Assert
        expected_result = entities.StateBond.new_with_defaults(
            bond_type_raw_text='BOND REVOKED', status=BondStatus.REVOKED)
        self.assertEqual(result, expected_result)
Esempio n. 7
0
    def testParseBond_MapStatusToType(self) -> None:
        # Arrange
        ingest_bond = ingest_info_pb2.StateBond(state_code="us_xx",
                                                bond_type="bond revoked")
        overrides_builder = EnumOverrides.Builder()
        overrides_builder.add("BOND REVOKED", BondStatus.REVOKED, BondType)
        overrides = overrides_builder.build()

        # Act
        result = state_bond.convert(
            ingest_bond, attr.evolve(_EMPTY_METADATA,
                                     enum_overrides=overrides))

        # Assert
        expected_result = entities.StateBond.new_with_defaults(
            state_code="US_XX",
            bond_type_raw_text="BOND REVOKED",
            status=BondStatus.REVOKED,
        )
        self.assertEqual(result, expected_result)