File size: 7,941 Bytes
a757bd3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | import unittest
import sys
if "/www/server/panel" not in sys.path:
sys.path.insert(0, "/www/server/panel")
from mod.base import RealProcess
if "/www/server/panel/class" not in sys.path:
sys.path.insert(0, "/www/server/panel/class")
import public
from mod.project.php.php_asyncMod import main as php_async
phpasync = php_async()
class Testmain(unittest.TestCase):
def test_create_project(self):
args = {
'webname':{"domain":"test.c","domainlist":[]},
'php_version':'74',
'site_path':'/xiaopacai/swoole-webim-demo-master',
'project_cmd':'php server/hsw_server.php start',
'install_dependence':'1',
'sql':'',
'sql_name':'',
'sql_user': '',
'sql_pwd': '',
'sql_codeing': '',
'project_ps': '',
'open_proxy': '',
'project_proxy_path': '',
'project_port': '',
}
# phpasync.create_project(public.to_dict_obj(args))
def test_delete_site(self):
args = {
'webname':"test.c",
'id':'1',
}
# phpasync.delete_site(public.to_dict_obj(args))
def test_get_project_list(self):
res = phpasync.get_project_list(public.to_dict_obj({}))
self.assertEqual(type(res), dict)
def test_project_get_domain(self):
args = {
'sitename':'sdadaw.c'
}
res = phpasync.project_get_domain(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_project_remove_domain(self):
self.fail()
def test_project_add_domain(self):
args = {
'sitename':'sdadaw.c',
'domain':["daw.daw","ssff.cxs"]
}
res = phpasync.project_add_domain(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_get_project_run_state(self):
args = {
'sitename':'sdadaw.c',
}
res = phpasync.get_project_run_state(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_modify_project_run_state(self):
args = {
'sitename':'sdadaw.c',
'status':'stop'
}
res = phpasync.modify_project_run_state(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_async_dependence_config(self):
self.fail()
def test_modify_project(self):
args = {
'sitename':'sdadaw.c',
'php_version':'74',
'project_path':'/xiaopacai/swoole-webim-demo-master',
'project_cmd':'php server/hsw_server.php start',
'site_run_path':'/xiaopacai/swoole-webim-demo-master',
'project_port': '',
}
res = phpasync.modify_project(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_get_project_log(self):
args = {
'sitename':'sdadaw.c',
}
res = phpasync.get_project_log(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_get_config_file(self):
args = {
'sitename':'sdadaw.c',
}
res = phpasync.get_config_file(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_upload_version(self):
self.fail()
def test_get_version_list(self):
args = {
'sitename':'sdadaw.c',
}
res = phpasync.get_version_list(public.to_dict_obj(args))
def test_remove_version(self):
args = {
'sitename':'sdadaw.c',
'version':'1'
}
res = phpasync.remove_version(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_recover_version(self):
args = {
'sitename':'sdadaw.c',
'version':'1'
}
res = phpasync.recover_version(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_now_file_backup(self):
args = {
'sitename':'sdadaw.c',
'version':'2'
}
res = phpasync.now_file_backup(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_set_version_ps(self):
args = {
'sitename':'sdadaw.c',
'version':'2',
'ps':'test'
}
res = phpasync.set_version_ps(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_get_setup_log(self):
args = {
'sitename':'sdadaw.c',
}
res = phpasync.get_setup_log(public.to_dict_obj(args))
self.assertEqual(type(res), dict)
def test_add_crontab(self):
pass
def test_get_crontab_list(self):
args = {
'sitename':'sdadaw.c',
}
res = phpasync.get_crontab_list(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_start_task(self):
args = {
'id':'19',
}
res = phpasync.start_task(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_modify_crontab_status(self):
args = {
'id':'19',
}
res = phpasync.modify_crontab_status(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_remove_crontab(self):
args = {
'id':'19',
}
res = phpasync.remove_crontab(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_modify_crontab(self):
pass
def test_get_crontab_log(self):
args = {
'id':'19',
}
res = phpasync.get_crontab_log(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_clearn_logs(self):
args = {
'id':'19',
}
res = phpasync.clearn_logs(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_get_group_list(self):
res = phpasync.get_group_list(public.to_dict_obj('{}'))
self.assertEqual(res['code'], 1)
def test_create_group(self):
args = {
'group_name':'test',
}
res = phpasync.create_group(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_remove_group(self):
args = {
'group_name':'test',
}
res = phpasync.remove_group(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_group_add_project(self):
args = {
'group_name':'test',
'project_name':'sdadaw.c'
}
res = phpasync.group_add_project(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_group_remove_project(self):
args = {
'group_name':'test',
'project_name':'sdadaw.c'
}
res = phpasync.group_remove_project(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_set_group_interval(self):
args = {
'group_name':'test',
'interval':'15'
}
res = phpasync.set_group_interval(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_set_group_status(self):
args = {
'group_name':'test',
'status':'1'
}
res = phpasync.set_group_status(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_get_proxy_file(self):
args = {
'sitename':'sdadaw.c',
'proxyname':'test'
}
res = phpasync.get_proxy_file(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
def test_save_proxy_file(self):
args = {
'sitename':'sdadaw.c',
'proxyname':'test',
'file':'test'
}
res = phpasync.save_proxy_file(public.to_dict_obj(args))
self.assertEqual(res['code'], 1)
if __name__ == '__main__':
unittest.main()
|