Skip to content

Commit

Permalink
PyOutline: Add facility support. (#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
splhack committed Apr 11, 2021
1 parent af75c67 commit e264132
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyoutline/outline/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def decode_layer(layer):

if "name" in data:
ol.set_name(data["name"])
if "facility" in data:
ol.set_facility(data["facility"])
if "range" in data:
ol.set_frame_range(data["range"])

Expand Down
12 changes: 12 additions & 0 deletions pyoutline/tests/json/facility.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "shell_command",
"facility": "test_facility",
"range": "1",
"layers": [
{
"name": "shell_layer",
"module": "outline.modules.shell.Shell",
"command": ["/bin/ls"]
}
]
}
6 changes: 6 additions & 0 deletions pyoutline/tests/json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def testJsonFile(self, systemMock):
systemMock.assert_has_calls([mock.call(['/bin/ls'], frame=1000)])
self.assertEqual('LAYER_VALUE', os.environ['LAYER_KEY'])

def testFacility(self):
"""Test facility from JSON"""
with open(os.path.join(JSON_DIR, 'facility.json')) as fp:
ol = outline.load_json(fp.read())
self.assertEqual('test_facility', ol.get_facility())


if __name__ == '__main__':
unittest.main()

0 comments on commit e264132

Please sign in to comment.
  翻译: