File: dockerio_test.py

package info (click to toggle)
salt 2014.1.13%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,572 kB
  • ctags: 9,221
  • sloc: python: 155,066; sh: 4,692; xml: 462; makefile: 197
file content (26 lines) | stat: -rw-r--r-- 920 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- 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
from salttesting.mock import MagicMock, patch, call

ensure_in_syspath('../../')

from salt.modules import dockerio

HAS_DOCKER = dockerio.__virtual__()


@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))