add test for community script shell type

This commit is contained in:
wh1te909 2021-01-29 09:37:34 +00:00
parent e17d25c156
commit b7578d939f
2 changed files with 10 additions and 4 deletions

View File

@ -195,4 +195,4 @@
"description": "Windows Defender Exclusions for Tactical RMM",
"shell": "powershell"
}
]
]

View File

@ -195,15 +195,21 @@ class TestScriptViews(TacticalTestCase):
info = json.load(f)
for script in info:
self.assertTrue(
os.path.exists(os.path.join(scripts_dir, script["filename"]))
)
fn: str = script["filename"]
self.assertTrue(os.path.exists(os.path.join(scripts_dir, fn)))
self.assertTrue(script["filename"])
self.assertTrue(script["name"])
self.assertTrue(script["description"])
self.assertTrue(script["shell"])
self.assertIn(script["shell"], valid_shells)
if fn.endswith(".ps1"):
self.assertEqual(script["shell"], "powershell")
elif fn.endswith(".bat"):
self.assertEqual(script["shell"], "cmd")
elif fn.endswith(".py"):
self.assertEqual(script["shell"], "python")
def test_load_community_scripts(self):
with open(
os.path.join(settings.BASE_DIR, "scripts/community_scripts.json")