Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F25451387
test_paas_docker.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
test_paas_docker.py
View Options
from
importlib.machinery
import
SourceFileLoader
import
unittest
salt_test_case
=
SourceFileLoader
(
'salt_test_case'
,
"salt_test_case.py"
)
.
load_module
()
docker
=
SourceFileLoader
(
'docker'
,
'../_modules/paas_docker.py'
)
.
load_module
()
class
Testinstance
(
unittest
.
TestCase
,
salt_test_case
.
SaltTestCase
):
def
setUp
(
self
):
self
.
initialize_mocks
()
self
.
instance
=
docker
self
.
mock_pillar
(
'data/paas_docker.yaml'
)
self
.
mock_grains
()
self
.
grains
[
'id'
]
=
'egladil'
def
test_get_image
(
self
):
container
=
{
"image"
:
"foo"
,
"version"
:
"42"
}
self
.
assertEqual
(
"foo:42"
,
docker
.
get_image
(
"not_foo"
,
container
))
def
test_get_image_without_version
(
self
):
container
=
{
"image"
:
"foo"
,
}
self
.
assertEqual
(
"foo"
,
docker
.
get_image
(
"not_foo"
,
container
))
def
test_get_image_without_image
(
self
):
container
=
{
"version"
:
"42"
}
self
.
assertEqual
(
"not_foo:42"
,
docker
.
get_image
(
"not_foo"
,
container
))
def
test_get_image_without_anything
(
self
):
self
.
assertEqual
(
"not_foo"
,
docker
.
get_image
(
"not_foo"
,
{}))
def
test_get_image_with_numeric_version
(
self
):
container
=
{
"image"
:
"foo"
,
"version"
:
2.5
}
self
.
assertEqual
(
"foo:2.5"
,
docker
.
get_image
(
"not_foo"
,
container
))
def
test_get_subnets
(
self
):
expected
=
[
'172.18.1.0/24'
,
'172.18.2.0/24'
,
'172.17.0.0/16'
]
self
.
assertEqual
(
expected
,
docker
.
get_subnets
())
def
test_get_subnets_when_none_are_defined
(
self
):
# Only the default Docker one
expected
=
[
'172.17.0.0/16'
]
self
.
grains
[
'id'
]
=
'voidserver'
self
.
assertEqual
(
expected
,
docker
.
get_subnets
())
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Thu, Apr 16, 05:17 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3600927
Default Alt Text
test_paas_docker.py (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment