Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nirina Malard
slapos
Commits
dfd4d114
Commit
dfd4d114
authored
Jun 13, 2017
by
Tomáš Peterka
Committed by
Rafael Monnerat
Jun 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapconfiguration.test] Replace tabs with spaces
parent
f8de4cc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
35 deletions
+35
-35
slapos/test/recipe/test_slaposconfiguration.py
slapos/test/recipe/test_slaposconfiguration.py
+35
-35
No files found.
slapos/test/recipe/test_slaposconfiguration.py
View file @
dfd4d114
...
@@ -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 -"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment