class FirmwareBundlesTest(unittest.TestCase):
    def setUp(self):
        self.host = '127.0.0.1'
        self.connection = connection(self.host, 800)
        self._firmware_bundles = FirmwareBundles(self.connection)

    @mock.patch.object(ResourceClient, 'upload')
    def test_upload(self, mock_upload):
        firmware_path = "test/SPPgen9snap6.2015_0405.81.iso"

        self._firmware_bundles.upload(firmware_path)

        mock_upload.assert_called_once_with(firmware_path, timeout=-1)
예제 #2
0
    def firmware_bundles(self):
        """
        Gets the FirmwareBundles API client.

        Returns:
            FirmwareBundles:
        """
        return FirmwareBundles(self.__connection)
예제 #3
0
    def firmware_bundles(self):
        """
        Gets the FirmwareBundles API client.

        Returns:
            FirmwareBundles:
        """
        if not self.__firmware_bundles:
            self.__firmware_bundles = FirmwareBundles(self.__connection)
        return self.__firmware_bundles
class FirmwareBundlesTest(unittest.TestCase):
    def setUp(self):
        self.host = '127.0.0.1'
        self.connection = connection(self.host, 800)
        self.uri = "/rest/firmware-bundles"
        self._firmware_bundles = FirmwareBundles(self.connection)

    @mock.patch.object(ResourceFileHandlerMixin, 'upload')
    def test_upload_firmware(self, mock_upload):
        firmware_path = "test/SPPgen9snap6.2015_0405.81.iso"
        self._firmware_bundles.upload(firmware_path)
        mock_upload.assert_called_once_with(firmware_path)

    @mock.patch.object(ResourceFileHandlerMixin, 'upload')
    def test_upload_compsig(self, mock_upload):
        sigfile = "test.sig"
        uri = self.uri + "/addCompsig"
        self._firmware_bundles.upload_compsig(sigfile)
        mock_upload.assert_called_once_with(sigfile, uri, -1)
 def setUp(self):
     self.host = '127.0.0.1'
     self.connection = connection(self.host, 800)
     self._firmware_bundles = FirmwareBundles(self.connection)