# Path: src/petmail/scripts/runner.py
# class NoNodeError(Exception):
# class BasedirParameterMixin:
# class NoOptions(BasedirParameterMixin, usage.Options):
# class BasedirArgument:
# class StartArguments(BasedirArgument):
# class CreateNodeOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class PrintBaseURLOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class StartNodeOptions(BasedirParameterMixin, StartArguments, usage.Options):
# class StopNodeOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class RestartNodeOptions(BasedirParameterMixin, StartArguments, usage.Options):
# class OpenOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class SampleOptions(BasedirParameterMixin, usage.Options):
# class InviteOptions(BasedirParameterMixin, usage.Options):
# class OfferMailboxOptions(BasedirParameterMixin, usage.Options):
# class AcceptMailboxOptions(BasedirParameterMixin, usage.Options):
# class SendBasicOptions(BasedirParameterMixin, usage.Options):
# class Options(usage.Options):
#     def __init__(self, basedir):
#     def __str__(self):
#     def postOptions(self):
#     def parseArgs(self, basedir=None):
#     def parseArgs(self, basedir=None, *twistd_args):
#     def postOptions(self):
#     def parseArgs(self, data="no data"):
#     def parseArgs(self, code=None):
#     def parseArgs(self, petname):
#     def parseArgs(self, code):
#     def parseArgs(self, cid, message):
#     def opt_version(self):
#     def opt_full_version(self):
#     def getUsage(self, **kwargs):
#     def postOptions(self):
# def create_node(*args):
# def print_baseurl(*args):
# def start(*args):
# def stop(*args):
# def restart(*args):
# def open_control_panel(*args):
# def invite(*args):
# def offer_mailbox(*args):
# def accept_mailbox(*args):
# def follow_messages(*args):
# def render_text(result):
# def render_all(result):
# def render_addressbook(result):
# def render_messages(result):
# def WebCommand(name, argnames, render=render_text, extra_args={}):
#     def _command(so, out, err):
# def accept(*args):
# def run(args, stdout, stderr, petmail=None):
# def entry():
# DISPATCH = {"create-node": create_node,
#             "print-baseurl": print_baseurl,
#             "start": start,
#             "stop": stop,
#             "restart": restart,
#             "open": open_control_panel,
# 
#             "sample": WebCommand("sample", ["data", "success-object",
#                                             "error", "server-error"]),
#             "invite": invite,
#             "offer-mailbox": offer_mailbox,
#             "accept-mailbox": accept_mailbox,
#             "addressbook": WebCommand("list-addressbook", [],
#                                       render=render_addressbook),
#             "send-basic": WebCommand("send-basic", ["cid", "message"]),
#             "fetch-messages": WebCommand("fetch-messages", [],
#                                          render=render_messages),
#             "follow-messages": follow_messages,
#             "accept": accept,
#             }
# 
# Path: src/petmail/scripts/webwait.py
# def get_url_and_token(basedir, err):
# def wait(basedir, err=sys.stderr):
# def parse_url(url, defaultPort=None):
#     def __init__(self, url, err):
#     def read(self):
# def do_http(method, url, body="", event_stream=False):
# def command(basedir, command, args, err=sys.stderr):
# def follow_events(basedir, topic, catchup=False, err=sys.stderr):
# def get_line(r):
# def get_field(r):
#     MAX_TRIES = 1000
# class BadResponse(object):
# class EOFError(Exception):


import textwrap
from StringIO import StringIO
from twisted.trial import unittest
from ..scripts import runner, webwait

# Test arg parsing and construction of the JSON request body, and the right
# webapi endpoint being specified. Do not actually do HTTP. Do not run any
# node code. Generate a fake HTTP response, then test response parsing and
# rc/stdout/stderr generation.

OK = {"ok": "ok"}

class CLI(unittest.TestCase):
    def setUp(self):
        webwait._debug_no_http = self.called
    def tearDown(self):

# Path: src/petmail/scripts/runner.py
# class NoNodeError(Exception):
# class BasedirParameterMixin:
# class NoOptions(BasedirParameterMixin, usage.Options):
# class BasedirArgument:
# class StartArguments(BasedirArgument):
# class CreateNodeOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class PrintBaseURLOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class StartNodeOptions(BasedirParameterMixin, StartArguments, usage.Options):
# class StopNodeOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class RestartNodeOptions(BasedirParameterMixin, StartArguments, usage.Options):
# class OpenOptions(BasedirParameterMixin, BasedirArgument, usage.Options):
# class SampleOptions(BasedirParameterMixin, usage.Options):
# class InviteOptions(BasedirParameterMixin, usage.Options):
# class OfferMailboxOptions(BasedirParameterMixin, usage.Options):
# class AcceptMailboxOptions(BasedirParameterMixin, usage.Options):
# class SendBasicOptions(BasedirParameterMixin, usage.Options):
# class Options(usage.Options):
#     def __init__(self, basedir):
#     def __str__(self):
#     def postOptions(self):
#     def parseArgs(self, basedir=None):
#     def parseArgs(self, basedir=None, *twistd_args):
#     def postOptions(self):
#     def parseArgs(self, data="no data"):
#     def parseArgs(self, code=None):
#     def parseArgs(self, petname):
#     def parseArgs(self, code):
#     def parseArgs(self, cid, message):
#     def opt_version(self):
#     def opt_full_version(self):
#     def getUsage(self, **kwargs):
#     def postOptions(self):
# def create_node(*args):
# def print_baseurl(*args):
# def start(*args):
# def stop(*args):
# def restart(*args):
# def open_control_panel(*args):
# def invite(*args):
# def offer_mailbox(*args):
# def accept_mailbox(*args):
# def follow_messages(*args):
# def render_text(result):
# def render_all(result):
# def render_addressbook(result):
# def render_messages(result):
# def WebCommand(name, argnames, render=render_text, extra_args={}):
#     def _command(so, out, err):
# def accept(*args):
# def run(args, stdout, stderr, petmail=None):
# def entry():
# DISPATCH = {"create-node": create_node,
#             "print-baseurl": print_baseurl,
#             "start": start,
#             "stop": stop,
#             "restart": restart,
#             "open": open_control_panel,
# 
#             "sample": WebCommand("sample", ["data", "success-object",
#                                             "error", "server-error"]),
#             "invite": invite,
#             "offer-mailbox": offer_mailbox,
#             "accept-mailbox": accept_mailbox,
#             "addressbook": WebCommand("list-addressbook", [],
#                                       render=render_addressbook),
#             "send-basic": WebCommand("send-basic", ["cid", "message"]),
#             "fetch-messages": WebCommand("fetch-messages", [],
#                                          render=render_messages),
#             "follow-messages": follow_messages,
#             "accept": accept,
#             }
# 
# Path: src/petmail/scripts/webwait.py
# def get_url_and_token(basedir, err):
# def wait(basedir, err=sys.stderr):
# def parse_url(url, defaultPort=None):
#     def __init__(self, url, err):
#     def read(self):
# def do_http(method, url, body="", event_stream=False):
# def command(basedir, command, args, err=sys.stderr):
# def follow_events(basedir, topic, catchup=False, err=sys.stderr):
# def get_line(r):
# def get_field(r):
#     MAX_TRIES = 1000
# class BadResponse(object):
# class EOFError(Exception):


# Path: src/petmail/test/test_cli.py
import textwrap
from StringIO import StringIO
from twisted.trial import unittest
from ..scripts import runner, webwait


# Test arg parsing and construction of the JSON request body, and the right
# webapi endpoint being specified. Do not actually do HTTP. Do not run any
# node code. Generate a fake HTTP response, then test response parsing and
# rc/stdout/stderr generation.

OK = {"ok": "ok"}

class CLI(unittest.TestCase):
    def setUp(self):
        webwait._debug_no_http = self.called
    def tearDown(self):

        webwait._debug_no_http = None