Ejemplo n.º 1
0
    def test_mapping(self):
        result = parse_issue(
            self.issue,
            FieldMapping({
                "string_field": "string_output_field",
                "string_list_field": "string_output_list_field",
                "dict_field.member1": "dict_field_1",
                "dict_field.member2": "dict_field_2",
                "dict_list_field.member1": "dict_list_field_1",
                "dict_legacy.key": "dict_legacy",
                "watchers.watchCount": "watchCount",
            }),
        )

        self.assertEqual(result["key"], "KEY-1")
        self.assertEqual(result["string_output_field"], "value1")
        self.assertEqual(result["int_field"], 123)
        self.assertEqual(result["string_output_list_field"], "value1,value2")
        self.assertEqual(result["dict_field_1"], "value1")
        self.assertEqual(result["dict_field_2"], "value2")
        self.assertEqual(result["dict_list_field_1"], "value1a,value1b")
        self.assertEqual(result["dict_legacy"], "legacyKey")
        self.assertEqual("dict_legacy_key" in result, False)
        self.assertEqual("dict_legacy_name" in result, False)
        self.assertEqual("watchers" in result, False)
        self.assertEqual(result["watchCount"], 10)
Ejemplo n.º 2
0
    def test_mapping(self):
        result = parse_issue(
            self.issue,
            FieldMapping({
                'string_field': 'string_output_field',
                'string_list_field': 'string_output_list_field',
                'dict_field.member1': 'dict_field_1',
                'dict_field.member2': 'dict_field_2',
                'dict_list_field.member1': 'dict_list_field_1',
                'dict_legacy.key': 'dict_legacy',
                'watchers.watchCount': 'watchCount',
            }))

        self.assertEqual(result['key'], 'KEY-1')
        self.assertEqual(result['string_output_field'], 'value1')
        self.assertEqual(result['int_field'], 123)
        self.assertEqual(result['string_output_list_field'], 'value1,value2')
        self.assertEqual(result['dict_field_1'], 'value1')
        self.assertEqual(result['dict_field_2'], 'value2')
        self.assertEqual(result['dict_list_field_1'], 'value1a,value1b')
        self.assertEqual(result['dict_legacy'], 'legacyKey')
        self.assertEqual('dict_legacy_key' in result, False)
        self.assertEqual('dict_legacy_name' in result, False)
        self.assertEqual('watchers' in result, False)
        self.assertEqual(result['watchCount'], 10)
Ejemplo n.º 3
0
    def test_no_mapping(self):
        result = parse_issue(self.issue, FieldMapping({}))

        self.assertEqual(result['key'], 'KEY-1')
        self.assertEqual(result['string_field'], 'value1')
        self.assertEqual(result['int_field'], 123)
        self.assertEqual(result['string_list_field'], 'value1,value2')
        self.assertEqual('dict_field' in result, False)
        self.assertEqual('dict_list_field' in result, False)
        self.assertEqual(result['dict_legacy'], 'legacyValue')
        self.assertEqual(result['dict_legacy_key'], 'legacyKey')
        self.assertEqual(result['dict_legacy_name'], 'legacyName')
        self.assertEqual(result['watchers'], 10)
Ejemplo n.º 4
0
    def test_no_mapping(self):
        result = parse_issue(self.issue, FieldMapping({}))

        self.assertEqual(result["key"], "KEY-1")
        self.assertEqual(result["string_field"], "value1")
        self.assertEqual(result["int_field"], 123)
        self.assertEqual(result["string_list_field"], "value1,value2")
        self.assertEqual("dict_field" in result, False)
        self.assertEqual("dict_list_field" in result, False)
        self.assertEqual(result["dict_legacy"], "legacyValue")
        self.assertEqual(result["dict_legacy_key"], "legacyKey")
        self.assertEqual(result["dict_legacy_name"], "legacyName")
        self.assertEqual(result["watchers"], 10)
Ejemplo n.º 5
0
    def test_no_mapping(self):
        result = parse_issue(self.issue, FieldMapping({}))

        self.assertEqual(result['key'], 'KEY-1')
        self.assertEqual(result['string_field'], 'value1')
        self.assertEqual(result['int_field'], 123)
        self.assertEqual(result['string_list_field'], 'value1,value2')
        self.assertEqual('dict_field' in result, False)
        self.assertEqual('dict_list_field' in result, False)
        self.assertEqual(result['dict_legacy'], 'legacyValue')
        self.assertEqual(result['dict_legacy_key'], 'legacyKey')
        self.assertEqual(result['dict_legacy_name'], 'legacyName')
        self.assertEqual(result['watchers'], 10)
Ejemplo n.º 6
0
    def test_mapping_nonexisting_field(self):
        result = parse_issue(self.issue, FieldMapping({
            'non_existing_field': 'output_name1',
            'dict_field.non_existing_member': 'output_name2',
            'dict_list_field.non_existing_member': 'output_name3'
        }))

        self.assertEqual(result['key'], 'KEY-1')
        self.assertEqual(result['string_field'], 'value1')
        self.assertEqual(result['int_field'], 123)
        self.assertEqual(result['string_list_field'], 'value1,value2')
        self.assertEqual('dict_field' in result, False)
        self.assertEqual('dict_list_field' in result, False)
        self.assertEqual(result['dict_legacy'], 'legacyValue')
        self.assertEqual(result['dict_legacy_key'], 'legacyKey')
        self.assertEqual(result['dict_legacy_name'], 'legacyName')
        self.assertEqual(result['watchers'], 10)
Ejemplo n.º 7
0
    def test_mapping_nonexisting_field(self):
        result = parse_issue(
            self.issue,
            FieldMapping({
                'non_existing_field': 'output_name1',
                'dict_field.non_existing_member': 'output_name2',
                'dict_list_field.non_existing_member': 'output_name3'
            }))

        self.assertEqual(result['key'], 'KEY-1')
        self.assertEqual(result['string_field'], 'value1')
        self.assertEqual(result['int_field'], 123)
        self.assertEqual(result['string_list_field'], 'value1,value2')
        self.assertEqual('dict_field' in result, False)
        self.assertEqual('dict_list_field' in result, False)
        self.assertEqual(result['dict_legacy'], 'legacyValue')
        self.assertEqual(result['dict_legacy_key'], 'legacyKey')
        self.assertEqual(result['dict_legacy_name'], 'legacyName')
        self.assertEqual(result['watchers'], 10)
Ejemplo n.º 8
0
    def test_mapping_nonexisting_field(self):
        result = parse_issue(
            self.issue,
            FieldMapping({
                "non_existing_field": "output_name1",
                "dict_field.non_existing_member": "output_name2",
                "dict_list_field.non_existing_member": "output_name3",
            }),
        )

        self.assertEqual(result["key"], "KEY-1")
        self.assertEqual(result["string_field"], "value1")
        self.assertEqual(result["int_field"], 123)
        self.assertEqual(result["string_list_field"], "value1,value2")
        self.assertEqual("dict_field" in result, False)
        self.assertEqual("dict_list_field" in result, False)
        self.assertEqual(result["dict_legacy"], "legacyValue")
        self.assertEqual(result["dict_legacy_key"], "legacyKey")
        self.assertEqual(result["dict_legacy_name"], "legacyName")
        self.assertEqual(result["watchers"], 10)
Ejemplo n.º 9
0
    def test_mapping(self):
        result = parse_issue(self.issue, FieldMapping({
            'string_field': 'string_output_field',
            'string_list_field': 'string_output_list_field',
            'dict_field.member1': 'dict_field_1',
            'dict_field.member2': 'dict_field_2',
            'dict_list_field.member1': 'dict_list_field_1',
            'dict_legacy.key': 'dict_legacy',
            'watchers.watchCount': 'watchCount',
        }))

        self.assertEqual(result['key'], 'KEY-1')
        self.assertEqual(result['string_output_field'], 'value1')
        self.assertEqual(result['int_field'], 123)
        self.assertEqual(result['string_output_list_field'], 'value1,value2')
        self.assertEqual(result['dict_field_1'], 'value1')
        self.assertEqual(result['dict_field_2'], 'value2')
        self.assertEqual(result['dict_list_field_1'], 'value1a,value1b')
        self.assertEqual(result['dict_legacy'], 'legacyKey')
        self.assertEqual('dict_legacy_key' in result, False)
        self.assertEqual('dict_legacy_name' in result, False)
        self.assertEqual('watchers' in result, False)
        self.assertEqual(result['watchCount'], 10)