...
% ./SynoCI -h
usage: SynoCI [COMMAND] [OPTIONS]
optional arguments:
-h, --help show this help message and exit
commands:
Genereral commands:
list List tasks of the suite
update Update CIENVS library include (python-synowebapi,python-synodeploy
,python-synopyro,python-synomail)
log Show last run result log of the suite
list_suites List all suites
Code generate commands:
new Create a testsuites template
gen Generate a testcase
gen_webapi Generate a webapi testcase
del Undo code generate with "generate"
Run the tests:
run Run testspositional arguments:
suite Run the testsuites
optional arguments:
-h, --help show this help message and exit
-t testcase [testcase ...], --testcases testcase [testcase ...]
test case list
-g PATH, --group PATH
specify group to run
-c PATH, --config PATH
config file path [Default:
/synosrc/package/source/[Your
Project]/SynoTest/config.py]
-d PATH, --dslist PATH
Config file of test DiskStation list [Default:
/synosrc/package/CIENVS/venv/etc/ds_conf.py]
-w PATH, --winlist PATH
Config file of Windows list [Default:
/synosrc/package/CIENVS/venv/etc/win_conf.py]
-m PATH, --maclist PATH
Config file of Mac list [Default:
/synosrc/package/CIENVS/venv/etc/mac_conf.py]
-x PATH, --lnxlist PATH
Config file of Linux list [Default:
/synosrc/package/CIENVS/venv/etc/linux_conf.py]
-l LEVEL, --loglevel LEVEL
debug|info|warning|error|critical [Default: info]
-u, --unittest Only run unittest
-r, --regression Only run regression test
--ds_version DS_VERSION
specify ds version
--pkg_version PKG_VERSION
package version store in
SYNOTESTCONF._SYNOCI_PKG_VERSION% ./SynoCI update -h
usage: SynoCI [COMMAND] [OPTIONS] update [-h] [-U] [-p PATH] [-v]
example:
SynoCI update // Update CIENVS and update local projects(python-syno*)
example:
SynoCI update -U // Update CIENVS but not update local project
optional arguments:
-h, --help show this help message and exit
-U, --no_update_local
Not update python-* projects from git server or not
-p PATH, --path PATH The path to clone projs [Default:
/synosrc/package/source]
-v, --verbosity Show all update to stdoutimport unittest
from synowebapi.webapi import WebAPI
from synodeploy.ds_deploy.remote_cmd_exec import RemoteCmdExec
class TestWebapiTest(unittest.TestCase):
''' This is a Python unittest Example'''
DS = SYNOTESTCONF.DS
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def test_utilization_webapi(self):
params = {
"method":"get",
"version":1,
"type":"current",
"resource":[
"cpu","memory",
"network"
]
}
with WebAPI(host=self.DS.ip, usr=self.DS.usr, pwd=self.DS.pwd, port=5000) as webapi:
ret = webapi.sendAPI(api='SYNO.Core.System.Utilization', **params)
self.assertEqual(ret["success"], True)
def test_synogetkeyvalue(self):
with RemoteCmdExec(self.DS) as api:
cmd = '/usr/syno/bin/synogetkeyvalue /etc/synoinfo.conf company_title'
ret_code, out, err = api.remote_exec_cmd(cmd)
self.assertEqual(ret_code, 0)
self.assertEqual(out.strip(), 'Synology')