def test_package_stop(self): package = ensure_test_package() set_attr(package, "status", 10) api_r = requests.get(self.url + str(package.id) + "/action", params={"operation": "stop"}) self.assertEqual(requests.codes.ok, api_r.status_code, api_r.text) session.expire(package) self.assertEqual(0, package.status)
def test_package_hosts_name(self): package_id = get_test_package().id # one host add_host(package_id) # one with changed boinc host host = add_host(package_id) user = ensure_user() boinc_host = add_boinc_host(user.id) set_attr(boinc_host, "domain_name", "Test") set_attr(host, "boinc_host_id", boinc_host.id) for name in self.name_list: with self.subTest(name=name): api_r = self.exercise_package_hosts(package_id, name=name) self.verify_package_hosts(api_r, package_id, name=name)
def test_package_hosts_order_by(self): package_id = get_test_package().id # default host add_host(package_id) # host with new boinc_host host = add_host(package_id) user = ensure_user() boinc_host = add_boinc_host(user.id) set_attr(host, "boinc_host_id", boinc_host.id) for order_by in self.order_list: for desc in self.desc_list: with self.subTest(order_by=order_by, descending=desc): api_r = self.exercise_package_hosts(package_id, page=1, order_by=order_by, descending=desc) self.verify_package_hosts(api_r, package_id, page=1, order_by=order_by, descending=desc)