libnetworkcachetests.py 485 Bytes
Newer Older
Łukasz Nowak's avatar
Łukasz Nowak committed
1 2 3 4 5 6 7 8 9 10 11 12 13
import unittest
from slapos.libnetworkcache import NetworkcacheClient
import tempfile

class OfflineTest(unittest.TestCase):
  def test_download_offline(self):
    nc = NetworkcacheClient('http://127.0.0.1:0', 'http://127.0.0.1:0')
    self.assertRaises(IOError, nc.download, 'sha512sum')

  def test_upload_offline(self):
    content = tempfile.TemporaryFile()
    nc = NetworkcacheClient('http://127.0.0.1:0', 'http://127.0.0.1:0')
    self.assertRaises(IOError, nc.upload, content)