Exemple #1
0
    def test_structure_1(self):
        images = [self.CONTROLLER_IMAGE, self.SWITCH_IMAGE]

        image_handler = ImageHandler(self.device, images)

        self.assertEqual(image_handler.controller, self.EXPECTED_CONTROLLER)
        self.assertEqual(image_handler.switch, self.EXPECTED_SWITCH)
Exemple #2
0
    def test_structure_2_only_controller(self):
        images = {
            'controller': [self.CONTROLLER_IMAGE],
        }

        image_handler = ImageHandler(self.device, images)

        self.assertEqual(image_handler.controller, self.EXPECTED_CONTROLLER)
Exemple #3
0
    def test_structure_1_extra_entry(self):
        images = [
            '/path/to/controller_image.bin', '/path/to/switch_image.bin',
            'invalid entry'
        ]

        with self.assertRaises(Exception):
            ImageHandler(self.device, images)
Exemple #4
0
    def test_structure_2_extra_type(self):
        images = {
            'controller': ['/path/to/controller_image.bin'],
            'switch': ['/path/to/switch_image.bin'],
            'this shouldnt work': ['/path/to/switch_image.bin']
        }

        with self.assertRaises(Exception):
            ImageHandler(self.device, images)
Exemple #5
0
    def test_structure_3(self):
        images = {
            'controller': {
                'file': [self.CONTROLLER_IMAGE]
            },
            'switch': {
                'file': [self.SWITCH_IMAGE]
            }
        }

        image_handler = ImageHandler(self.device, images)

        self.assertEqual(image_handler.controller, self.EXPECTED_CONTROLLER)
        self.assertEqual(image_handler.switch, self.EXPECTED_SWITCH)
Exemple #6
0
    def test_structure_3_only_switch(self):
        images = {'switch': {'file': [self.SWITCH_IMAGE]}}

        image_handler = ImageHandler(self.device, images)

        self.assertEqual(image_handler.switch, self.EXPECTED_SWITCH)
Exemple #7
0
    def test_structure_1_only_switch(self):
        images = [self.SWITCH_IMAGE]

        image_handler = ImageHandler(self.device, images)

        self.assertEqual(image_handler.switch, self.EXPECTED_SWITCH)