-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from RondoRondoRondo/dev
Added fixtures/test.xml and test_scan_xml.py
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>flea3</name> | ||
<version>0.1.0</version> | ||
<description>The flea3 package</description> | ||
|
||
<maintainer email="[email protected]">Chao Qu</maintainer> | ||
|
||
<license>WTFPL</license> | ||
<buildtool_depend>catkin</buildtool_depend> | ||
|
||
<depend>roscpp</depend> | ||
<depend>nodelet</depend> | ||
<depend>camera_base</depend> | ||
<!--<depend>std_msgs</depend>--> | ||
<depend>dynamic_reconfigure</depend> | ||
<build_depend>message_generation</build_depend> | ||
<exec_depend>message_runtime</exec_depend> | ||
|
||
<export> | ||
<nodelet plugin="${prefix}/nodelet_plugins.xml"/> | ||
</export> | ||
</package> |
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,43 @@ | ||
from pathlib import Path | ||
from unittest import TestCase, mock | ||
|
||
from strelka.scanners.scan_xml import ScanXml as ScanUnderTest | ||
from strelka.tests import run_test_scan | ||
|
||
|
||
def test_scan_xml(mocker): | ||
""" | ||
Pass: Sample event matches output of scanner. | ||
Failure: Unable to load file or sample event fails to match. | ||
""" | ||
test_scan_event = { | ||
"elapsed": mock.ANY, | ||
"namespaces": [None], | ||
"tag_data": [], | ||
"flags": [], | ||
"tags": [ | ||
"package", | ||
"name", | ||
"version", | ||
"description", | ||
"maintainer", | ||
"license", | ||
"buildtool_depend", | ||
"depend", | ||
"build_depend", | ||
"exec_depend", | ||
"export", | ||
"nodelet", | ||
], | ||
"total": {"extracted": 0, "tags": 15}, | ||
"version": "1.0", | ||
} | ||
|
||
scanner_event = run_test_scan( | ||
mocker=mocker, | ||
scan_class=ScanUnderTest, | ||
fixture_path=Path(__file__).parent / "fixtures/test.xml", | ||
) | ||
|
||
TestCase.maxDiff = None | ||
TestCase().assertDictEqual(test_scan_event, scanner_event) |