Beispiel #1
0
    def test_expand_json(self):
        """
        Test the expand_json method
        """
        # GIVEN: A ThemeXML object and some JSON to "expand"
        theme = ThemeXML()
        theme_json = {
            'background': {
                'border_color': '#000000',
                'type': 'solid'
            },
            'display': {
                'vertical_align': 0
            },
            'font': {
                'footer': {
                    'bold': False
                },
                'main': {
                    'name': 'Arial'
                }
            }
        }

        # WHEN: ThemeXML.expand_json() is run
        theme.expand_json(theme_json)

        # THEN: The attributes should be set on the object
        self.assertEqual('#000000', theme.background_border_color, 'background_border_color should be "#000000"')
        self.assertEqual('solid', theme.background_type, 'background_type should be "solid"')
        self.assertEqual(0, theme.display_vertical_align, 'display_vertical_align should be 0')
        self.assertFalse(theme.font_footer_bold, 'font_footer_bold should be False')
        self.assertEqual('Arial', theme.font_main_name, 'font_main_name should be "Arial"')
Beispiel #2
0
    def test_expand_json(self):
        """
        Test the expand_json method
        """
        # GIVEN: A ThemeXML object and some JSON to "expand"
        theme = ThemeXML()
        theme_json = {
            'background': {
                'border_color': '#000000',
                'type': 'solid'
            },
            'display': {
                'vertical_align': 0
            },
            'font': {
                'footer': {
                    'bold': False
                },
                'main': {
                    'name': 'Arial'
                }
            }
        }

        # WHEN: ThemeXML.expand_json() is run
        theme.expand_json(theme_json)

        # THEN: The attributes should be set on the object
        self.assertEqual('#000000', theme.background_border_color,
                         'background_border_color should be "#000000"')
        self.assertEqual('solid', theme.background_type,
                         'background_type should be "solid"')
        self.assertEqual(0, theme.display_vertical_align,
                         'display_vertical_align should be 0')
        self.assertFalse(theme.font_footer_bold,
                         'font_footer_bold should be False')
        self.assertEqual('Arial', theme.font_main_name,
                         'font_main_name should be "Arial"')