Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b655d579
Commit
b655d579
authored
Aug 19, 2013
by
Michael Scherer
Committed by
James Cammarata
Aug 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for the -i option when used with raw string for ipv4
and ipv6 addresses.
parent
3aac1873
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
test/TestInventory.py
+30
-0
No files found.
test/TestInventory.py
View file @
b655d579
...
...
@@ -114,6 +114,36 @@ class TestInventory(unittest.TestCase):
print
expected_hosts
assert
sorted
(
hosts
)
==
sorted
(
expected_hosts
)
def
test_simple_string_ipv4
(
self
):
inventory
=
Inventory
(
'127.0.0.1,192.168.1.1'
)
hosts
=
inventory
.
list_hosts
()
self
.
assertEqual
(
sorted
(
hosts
),
sorted
([
'127.0.0.1'
,
'192.168.1.1'
]))
def
test_simple_string_ipv4_port
(
self
):
inventory
=
Inventory
(
'127.0.0.1:2222,192.168.1.1'
)
hosts
=
inventory
.
list_hosts
()
self
.
assertEqual
(
sorted
(
hosts
),
sorted
([
'127.0.0.1'
,
'192.168.1.1'
]))
def
test_simple_string_ipv4_vars
(
self
):
inventory
=
Inventory
(
'127.0.0.1:2222,192.168.1.1'
)
var
=
inventory
.
get_variables
(
'127.0.0.1'
)
self
.
assertEqual
(
var
[
'ansible_ssh_port'
],
2222
)
def
test_simple_string_ipv6
(
self
):
inventory
=
Inventory
(
'FE80:EF45::12:1,192.168.1.1'
)
hosts
=
inventory
.
list_hosts
()
self
.
assertEqual
(
sorted
(
hosts
),
sorted
([
'FE80:EF45::12:1'
,
'192.168.1.1'
]))
def
test_simple_string_ipv6_port
(
self
):
inventory
=
Inventory
(
'[FE80:EF45::12:1]:2222,192.168.1.1'
)
hosts
=
inventory
.
list_hosts
()
self
.
assertEqual
(
sorted
(
hosts
),
sorted
([
'FE80:EF45::12:1'
,
'192.168.1.1'
]))
def
test_simple_string_ipv6_vars
(
self
):
inventory
=
Inventory
(
'[FE80:EF45::12:1]:2222,192.168.1.1'
)
var
=
inventory
.
get_variables
(
'FE80:EF45::12:1'
)
self
.
assertEqual
(
var
[
'ansible_ssh_port'
],
2222
)
def
test_simple_vars
(
self
):
inventory
=
self
.
simple_inventory
()
vars
=
inventory
.
get_variables
(
'thor'
)
...
...
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