def testParseStateAliasNameParts(self):
        # Arrange
        ingest_alias = ingest_info_pb2.StateAlias(
            state_alias_id='ALIAS_ID',
            state_code='US_ND',
            given_names='FRANK',
            middle_names='LONNY',
            surname='OCEAN',
            name_suffix='BREAUX',
            alias_type='GIVEN',
        )

        # Act
        result = state_alias.convert(ingest_alias, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StatePersonAlias(
            state_code='US_ND',
            full_name='{"given_names": "FRANK", '
            '"middle_names": "LONNY", '
            '"name_suffix": "BREAUX", '
            '"surname": "OCEAN"}',
            alias_type=StatePersonAliasType.GIVEN_NAME,
            alias_type_raw_text='GIVEN',
        )

        self.assertEqual(result, expected_result)
예제 #2
0
    def testParseStateAliasTooManyNames():
        # Arrange
        ingest_alias = ingest_info_pb2.StateAlias(
            state_alias_id='ALIAS_ID',
            full_name='FRANK OCEAN',
            given_names='FRANK',
            middle_names='LONNY',
            surname='OCEAN',
            name_suffix='BREAUX',
        )

        # Act
        with pytest.raises(ValueError):
            state_alias.convert(ingest_alias, _EMPTY_METADATA)
예제 #3
0
    def testParseStateAliasTooManyNames():
        # Arrange
        ingest_alias = ingest_info_pb2.StateAlias(
            state_alias_id="ALIAS_ID",
            full_name="FRANK OCEAN",
            given_names="FRANK",
            middle_names="LONNY",
            surname="OCEAN",
            name_suffix="BREAUX",
            alias_type="NICKNAME",
        )

        # Act
        with pytest.raises(ValueError):
            state_alias.convert(ingest_alias, _EMPTY_METADATA)
예제 #4
0
    def testParseStateAliasFullName(self):
        # Arrange
        ingest_alias = ingest_info_pb2.StateAlias(
            state_code='US_ND',
            state_alias_id='ALIAS_ID',
            full_name='FRANK OCEAN',
        )

        # Act
        result = state_alias.convert(ingest_alias, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StatePersonAlias(
            state_code='US_ND',
            full_name='{"full_name": "FRANK OCEAN"}',
        )

        self.assertEqual(result, expected_result)
예제 #5
0
    def testParseStateAliasFullName(self):
        # Arrange
        ingest_alias = ingest_info_pb2.StateAlias(
            state_code="US_ND",
            state_alias_id="ALIAS_ID",
            full_name="FRANK OCEAN",
            alias_type="NICKNAME",
        )

        # Act
        result = state_alias.convert(ingest_alias, _EMPTY_METADATA)

        # Assert
        expected_result = entities.StatePersonAlias(
            state_code="US_ND",
            full_name='{"full_name": "FRANK OCEAN"}',
            alias_type=StatePersonAliasType.NICKNAME,
            alias_type_raw_text="NICKNAME",
        )

        self.assertEqual(result, expected_result)