def switch_types(self): """ Gets the SwitchTypes API client. Returns: SwitchTypes: """ return SwitchTypes(self.__connection)
def switch_types(self): """ Gets the SwitchTypes API client. Returns: SwitchTypes: """ if not self.__switch_types: self.__switch_types = SwitchTypes(self.__connection) return self.__switch_types
class SwitchTypesTest(unittest.TestCase): def setUp(self): self.host = '127.0.0.1' self.connection = connection(self.host) self._switch_types = SwitchTypes(self.connection) @mock.patch.object(ResourceClient, 'get') def test_get_called_once(self, mock_get): self._switch_types.get('c6f4e705-2bb5-430a-b7a1-a35b2f7aa9b9') mock_get.assert_called_once_with( 'c6f4e705-2bb5-430a-b7a1-a35b2f7aa9b9') @mock.patch.object(ResourceClient, 'get_all') def test_get_all_called_once(self, mock_get_all): filter = 'name=TestName' sort = 'name:ascending' self._switch_types.get_all(2, 500, filter, sort) mock_get_all.assert_called_once_with(2, 500, filter=filter, sort=sort) @mock.patch.object(ResourceClient, 'get_by') def test_get_by_called_once(self, mock_get_by): self._switch_types.get_by('name', 'Cisco Nexus 6xxx') mock_get_by.assert_called_once_with( 'name', 'Cisco Nexus 6xxx')
class SwitchTypesTest(unittest.TestCase): def setUp(self): self.host = '127.0.0.1' self.connection = connection(self.host) self._switch_types = SwitchTypes(self.connection) @mock.patch.object(ResourceHelper, 'get_all') def test_get_all_called_once(self, mock_get_all): filter = 'name=TestName' sort = 'name:ascending' self._switch_types.get_all(2, 500, filter, sort) mock_get_all.assert_called_once_with(start=2, count=500, filter=filter, sort=sort) @mock.patch.object(ResourceHelper, 'get_all') def test_get_by_called_once(self, mock_get_all): self._switch_types.get_by('name', 'Cisco Nexus 6xxx') mock_get_all.assert_called_once_with(count=-1, filter='"name=\'Cisco Nexus 6xxx\'"', sort='', start=0)
class SwitchTypesTest(unittest.TestCase): def setUp(self): self.host = '127.0.0.1' self.connection = connection(self.host) self._switch_types = SwitchTypes(self.connection) @mock.patch.object(ResourceHelper, 'get_all') def test_get_all_called_once(self, mock_get_all): filter = 'name=TestName' sort = 'name:ascending' self._switch_types.get_all(2, 500, filter, sort) mock_get_all.assert_called_once_with(start=2, count=500, filter=filter, sort=sort) @mock.patch.object(ResourceHelper, 'get_all') def test_get_by_called_once(self, mock_get_all): self._switch_types.get_by('name', 'Cisco Nexus 6xxx') mock_get_all.assert_called_once_with( count=-1, filter='"name=\'Cisco Nexus 6xxx\'"', sort='', start=0)
def setUp(self): self.host = '127.0.0.1' self.connection = connection(self.host) self._switch_types = SwitchTypes(self.connection)
def switch_types(self): if not self.__switch_types: self.__switch_types = SwitchTypes(self.__connection) return self.__switch_types