Commit dfd4d114 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Rafael Monnerat

[slapconfiguration.test] Replace tabs with spaces

parent f8de4cc4
...@@ -10,44 +10,44 @@ from slapos import format as slapformat ...@@ -10,44 +10,44 @@ from slapos import format as slapformat
class SlapConfigurationTest(unittest.TestCase): class SlapConfigurationTest(unittest.TestCase):
def setUp(self): def setUp(self):
"""Prepare files on filesystem.""" """Prepare files on filesystem."""
self.instance_root = "/tmp/instance_test_resourcefile" self.instance_root = "/tmp/instance_test_resourcefile"
os.mkdir(self.instance_root) os.mkdir(self.instance_root)
# create testing resource file # create testing resource file
self.resource_file = os.path.join(self.instance_root, slapformat.Partition.resource_file) self.resource_file = os.path.join(self.instance_root, slapformat.Partition.resource_file)
self.resource = { self.resource = {
"tun": { "tun": {
"ipv4": "192.168.0.1" "ipv4": "192.168.0.1"
}, },
"address_list": [ "address_list": [
10, 20 10, 20
] ]
} }
with open(self.resource_file, "wt") as fo: with open(self.resource_file, "wt") as fo:
json.dump(self.resource, fo) json.dump(self.resource, fo)
# do your tests inside try block and clean up in finally # do your tests inside try block and clean up in finally
self.buildout = { self.buildout = {
"buildout": { "buildout": {
"directory": self.instance_root "directory": self.instance_root
} }
} }
def tearDown(self): def tearDown(self):
os.unlink(self.resource_file) os.unlink(self.resource_file)
os.rmdir(self.instance_root) os.rmdir(self.instance_root)
@mock.patch("slapos.slap.slap") @mock.patch("slapos.slap.slap")
def test_correct_naming(self, MockClient): def test_correct_naming(self, MockClient):
"""Test correct naming of variables from resource file.""" """Test correct naming of variables from resource file."""
MockClient.initializeConnection.return_value = None MockClient.initializeConnection.return_value = None
MockClient.getInstanceParameterDict.return_value = dict() MockClient.getInstanceParameterDict.return_value = dict()
options = defaultdict(str) options = defaultdict(str)
recipe = slapconfiguration.Recipe(self.buildout, "slapconfiguration", options) recipe = slapconfiguration.Recipe(self.buildout, "slapconfiguration", options)
self.assertEqual(options['tun-ipv4'], "192.168.0.1", self.assertEqual(options['tun-ipv4'], "192.168.0.1",
"Folded attrs should be separated by -") "Folded attrs should be separated by -")
self.assertEqual(options['address-list'], [10, 20], self.assertEqual(options['address-list'], [10, 20],
"All underscores should be replaced with -") "All underscores should be replaced with -")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment