Esempio n. 1
0
    def test_stream_to(self):
        glance_image = self.mox.CreateMock(utils.GlanceImage)
        glance_image.download_to('file').AndReturn('result')
        raw_image = utils.RawImage(glance_image)
        self.mox.ReplayAll()

        self.assertEqual('result', raw_image.stream_to('file'))
Esempio n. 2
0
    def test_get_size(self):
        glance_image = self.mox.CreateMock(utils.GlanceImage)
        glance_image.meta = {'size': '123'}
        raw_image = utils.RawImage(glance_image)
        self.mox.ReplayAll()

        self.assertEqual(123, raw_image.get_size())
Esempio n. 3
0
    def test_stream_to(self, mock_glance_image):
        mock_glance_image.download_to.return_value = 'result'
        raw_image = utils.RawImage(mock_glance_image)

        self.assertEqual('result', raw_image.stream_to('file'))
        mock_glance_image.download_to.assert_called_once_with('file')
Esempio n. 4
0
    def test_get_size(self, mock_glance_image):
        mock_glance_image.meta = {'size': '123'}
        raw_image = utils.RawImage(mock_glance_image)

        self.assertEqual(123, raw_image.get_size())