add test for community script shell type
@@ -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")
