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
|
|
|
|
2013-12-19 16:14:59 +00:00
|
|
|
@skipIf(not HAS_DOCKER, "The docker execution module must be available to run the DockerIO test case")
|
|
|
|
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))
|