2013-12-19 16:14:59 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
:codauthor: :email:`Mike Place <mp@saltstack.com>`
|
|
|
|
'''
|
|
|
|
|
|
|
|
# Import Salt Testing libs
|
|
|
|
from salttesting import TestCase, skipIf
|
|
|
|
from salttesting.helpers import ensure_in_syspath
|
|
|
|
|
|
|
|
ensure_in_syspath('../../')
|
|
|
|
|
|
|
|
from salt.modules import dockerio
|
|
|
|
|
|
|
|
HAS_DOCKER = dockerio.__virtual__()
|
|
|
|
|
2013-12-21 00:23:35 +00:00
|
|
|
|
2014-03-31 01:55:51 +00:00
|
|
|
@skipIf(not HAS_DOCKER, 'The docker execution module must be available to run the DockerIO test case')
|
2013-12-19 16:14:59 +00:00
|
|
|
class DockerIoTestCase(TestCase):
|
|
|
|
def test__sizeof_fmt(self):
|
|
|
|
self.assertEqual('0.0 bytes', dockerio._sizeof_fmt(0))
|
|
|
|
self.assertEqual('1.0 KB', dockerio._sizeof_fmt(1024))
|
|
|
|
self.assertEqual('1.0 MB', dockerio._sizeof_fmt(1024**2))
|
|
|
|
self.assertEqual('1.0 GB', dockerio._sizeof_fmt(1024**3))
|
|
|
|
self.assertEqual('1.0 TB', dockerio._sizeof_fmt(1024**4))
|
|
|
|
self.assertEqual('1.0 PB', dockerio._sizeof_fmt(1024**5))
|
2014-03-31 01:55:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(DockerIoTestCase, needs_daemon=False)
|