Example #1
0
    def test_no_value(self):
        target = Target()
        acutal = {
            "en": {
                "black": [
                    {
                        "key": "black",
                        "type": "color"
                    }
                ]
            }
        }

        target.add_value(
            acutal,
            "en",
            "blue",
            [
                {
                    "key": "blue",
                    "type": "color"
                }
            ]
        )

        self.assertDictEqual(
            {
                'en': {
                    'black': [{'key': 'black', 'type': 'color'}],
                    'blue': [{'key': 'blue', 'type': 'color'}]
                }
            },
            acutal
        )
Example #2
0
    def test_already_exsits(self):
        target = Target()
        acutal = {"en": {"black": [{"key": "black", "type": "color"}]}}

        target.add_value(acutal, "en", "black", [{
            "key": "new_black",
            "type": "color"
        }])

        self.assertDictEqual(
            {
                'en': {
                    'black': [{
                        'key': 'black',
                        'type': 'color'
                    }, {
                        'key': 'new_black',
                        'type': 'color'
                    }]
                }
            }, acutal)
Example #3
0
    def test_no_value(self):
        target = Target()
        acutal = {"en": {"black": [{"key": "black", "type": "color"}]}}

        target.add_value(acutal, "en", "blue", [{
            "key": "blue",
            "type": "color"
        }])

        self.assertDictEqual(
            {
                'en': {
                    'black': [{
                        'key': 'black',
                        'type': 'color'
                    }],
                    'blue': [{
                        'key': 'blue',
                        'type': 'color'
                    }]
                }
            }, acutal)
Example #4
0
    def test_already_exsits(self):
        target = Target()
        acutal = {
            "en": {
                "black": [
                    {
                        "key": "black",
                        "type": "color"
                    }
                ]
            }
        }

        target.add_value(
            acutal,
            "en",
            "black",
            [
                {
                    "key": "new_black",
                    "type": "color"
                }
            ]
        )

        self.assertDictEqual(
            {
                'en': {
                    'black': [
                        {'key': 'black', 'type': 'color'},
                        {'key': 'new_black', 'type': 'color'}
                    ]
                }
            },
            acutal
        )