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'))
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())
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')
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())