Example #1
0
class BaseClientTest(unittest.TestCase):
    def setUp(self):
       self.transport = proto_helpers.FakeDatagramTransport()
       self.client = BaseClient()
       self.client.transport = self.transport
       self.FAKE_ENDPOINT = ('111.22.33.44', 4000)

    def test_heartbeat(self):
        self.client.datagramReceived('HEART', self.FAKE_ENDPOINT)
        resp, addr = self.transport.written[0] 
        self.assertEqual(resp, 'BEAT')
Example #2
0
def main():
    logger = logging.getLogger(__name__)
    console = logging.StreamHandler()
    formatter = logging.Formatter('%(levelname)s - %(message)s')
    console.setFormatter(formatter)
    logger.addHandler(console)

    client = BaseClient(logger)

    parser, argv = config('Manage ConPaaS users.', logger)

    _user_cmd = UserCmd(parser, client)

    argcomplete.autocomplete(parser)
    args = parser.parse_args(argv)
    client.set_config(args.director_url, args.username, args.password,
                      args.debug)
    try:
        args.run_cmd(args)
    except:
        ex = sys.exc_info()[1]
        sys.stderr.write("ERROR general: %s\n" % ex)
        traceback.print_exc()
        sys.exit(1)
Example #3
0
 def setUp(self):
    self.transport = proto_helpers.FakeDatagramTransport()
    self.client = BaseClient()
    self.client.transport = self.transport
    self.FAKE_ENDPOINT = ('111.22.33.44', 4000)