Skip to content

Commit

Permalink
Integration test REST bootstrap data.
Browse files Browse the repository at this point in the history
Extend the charon.py integration test to also exercise getbootstrapdata
via the new REST interface between client and server.
  • Loading branch information
domob1812 committed Sep 30, 2020
1 parent 3e1f510 commit b3c83b8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gametest/charon.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
PUBSUB = "pubsub.chat.xaya.io"


# Port and URL for the local REST API used for bootstrap data.
REST_PORT = 18_042
REST_URL = "http://localhost:%d" % REST_PORT


def testAccountJid (acc):
return "%s@%s" % (acc[0], XMPP_SERVER)

Expand Down Expand Up @@ -79,6 +84,7 @@ def __enter__ (self):
args = [self.binary]
args.extend (["--datadir", self.datadir])
args.append ("--game_rpc_port=%d" % self.rpcport)
args.extend (["--rest_endpoint", REST_URL])
args.extend (["--charon", "client"])
args.extend (["--charon_server_jid", testAccountJid (TEST_ACCOUNTS[0])])
args.extend (["--charon_client_jid", testAccountJid (TEST_ACCOUNTS[1])])
Expand Down Expand Up @@ -142,6 +148,7 @@ def run (self):
args.extend (["--charon_pubsub_service", PUBSUB])
args.extend (["--charon_server_jid", testAccountJid (TEST_ACCOUNTS[0])])
args.extend (["--charon_password", TEST_ACCOUNTS[0][1]])
args.extend (["--rest_port", str (REST_PORT)])
self.startGameDaemon (extraArgs=args)

self.mainLogger.info ("Starting tauriond as Charon client...")
Expand All @@ -163,6 +170,10 @@ def run (self):
del res["server"]
self.assertEqual (res, srv)

self.mainLogger.info ("Testing bootstrap data via REST...")
res = client.rpc.getbootstrapdata ()
self.assertEqual (res, self.rpc.game.getbootstrapdata ())

self.mainLogger.info ("Testing invalid Charon method call...")
self.expectError (-32602, ".*Invalid method parameters.*",
client.rpc.getregions, 42)
Expand Down

0 comments on commit b3c83b8

Please sign in to comment.