def node_list_machines(url, ht_user, ht_pass): try: r = requests.get(os.path.join(url, "machines", "list"), params={"username": ht_user, "password": ht_pass}, verify=False) for machine in r.json()["machines"]: yield Machine(name=machine["name"], platform=machine["platform"], tags=machine["tags"]) except Exception as e: abort(404, message="Invalid Cuckoo node (%s): %s" % (url, e))
def test_machine(): machine = Machine() assert machine.__tablename__ == "machine" need_set = set(["id", "name", "platform", "tags", "node_id"]) have_set = set(dir(machine)) assert need_set & have_set == need_set