-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests/unit/test_load_plugins.py and fix load_plugins()
- Loading branch information
1 parent
5747829
commit 62ef058
Showing
3 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Regression tests for bugtool.load_plugins()""" | ||
|
||
|
||
def test_load_plugins(bugtool, dom0_template): | ||
"""Assert () returning arrays of the in the dom0-template""" | ||
|
||
# Use the plugins found in the dom0_template "/etc/xensource/bugtool": | ||
bugtool.PLUGIN_DIR = dom0_template + "/etc/xensource/bugtool" | ||
# Only process the xapi bugtool plugin: | ||
bugtool.entries = ["xapi"] | ||
# Reset the predefined caps and cap_sizes, so we can check the plugin code: | ||
# bugtool.caps = {} | ||
# bugtool.cap_sizes = {} | ||
# Load the xapi plugin: | ||
bugtool.load_plugins(just_capabilities=False) | ||
# Assert the set of properties of the created xapi capability: | ||
assert bugtool.caps["xapi"] == ( | ||
"xapi", | ||
"yes", | ||
-1, | ||
16384, | ||
-1, | ||
60, | ||
"text/plain", | ||
True, | ||
False, | ||
9, | ||
) | ||
# Assert the size of the created xapi capability: | ||
assert bugtool.cap_sizes["xapi"] == 0 | ||
print(bugtool.data) | ||
# Assert the entries added to the bugtool.data dict: | ||
assert bugtool.data == { | ||
"ls -l /proc/sys/dev/tty": { | ||
"cap": "xapi", | ||
"cmd_args": ["ls", "-l", "/proc/sys/dev/tty"], | ||
"filter": None, | ||
}, | ||
"/proc/sys/dev/tty": { | ||
"cap": "xapi", | ||
"filename": "/proc/sys/dev/tty", | ||
}, | ||
"/proc/sys/dev/tty/ldisc_autoload": { | ||
"cap": "xapi", | ||
"filename": "/proc/sys/dev/tty/ldisc_autoload", | ||
}, | ||
"tty": { | ||
"cap": "xapi", | ||
"cmd_args": "ls /proc/sys/dev/tty", | ||
"filter": None, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters