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
6030be38
Commit
6030be38
authored
Nov 14, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unittest for discrete functions in the apt module
parent
11e79d96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
test/units/module_tests/TestApt.py
+42
-0
No files found.
test/units/module_tests/TestApt.py
0 → 100644
View file @
6030be38
import
collections
import
mock
import
os
import
unittest
from
ansible.modules.core.packaging.os.apt
import
(
expand_pkgspec_from_fnmatches
,
)
class
AptExpandPkgspecTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
FakePackage
=
collections
.
namedtuple
(
"Package"
,
(
"name"
,))
self
.
fake_cache
=
[
FakePackage
(
"apt"
),
FakePackage
(
"apt-utils"
),
FakePackage
(
"not-selected"
),
]
def
test_trivial
(
self
):
foo
=
[
"apt"
]
self
.
assertEqual
(
expand_pkgspec_from_fnmatches
(
None
,
foo
,
self
.
fake_cache
),
foo
)
def
test_version_wildcard
(
self
):
foo
=
[
"apt=1.0*"
]
self
.
assertEqual
(
expand_pkgspec_from_fnmatches
(
None
,
foo
,
self
.
fake_cache
),
foo
)
def
test_pkgname_wildcard_version_wildcard
(
self
):
foo
=
[
"apt*=1.0*"
]
m_mock
=
mock
.
Mock
()
self
.
assertEqual
(
expand_pkgspec_from_fnmatches
(
m_mock
,
foo
,
self
.
fake_cache
),
[
'apt'
,
'apt-utils'
])
def
test_pkgname_expands
(
self
):
foo
=
[
"apt*"
]
m_mock
=
mock
.
Mock
()
self
.
assertEqual
(
expand_pkgspec_from_fnmatches
(
m_mock
,
foo
,
self
.
fake_cache
),
[
"apt"
,
"apt-utils"
])
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