示例#1
0
    def test_convert_mac_address(self):
        g = GroupAccessDeviceAddRequest()
        g.mac_address = 'aa:bb:cc:dd:ee:ff'
        g.convert_mac_address()
        self.assertEqual('aabbccddeeff', g.mac_address)

        g.mac_address = '1111.2222.3333'
        g.convert_mac_address()
        self.assertEqual('111122223333', g.mac_address)
示例#2
0
    def test_mac_address_gets_converted_on_build_command_xml(
            self, convert_mac_address_patch):
        g = GroupAccessDeviceAddRequest(device_name='dname',
                                        device_type='dtype',
                                        description='desc',
                                        group_id='testgroup')

        # expect convert not to be called yet
        self.assertFalse(convert_mac_address_patch.called)

        g.mac_address = 'aa:bb:cc:11:22:33'

        # now when we build to xml, expect it to be called
        g.build_command_xml()
        self.assertTrue(convert_mac_address_patch.called)