__authors__ = ['"Bill Magnuson" <*****@*****.**>']

from django.utils import simplejson
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import datastore_file_stub
from google.appengine.ext import db
from google.appengine.ext.db import Key
from game_server.server import application
from game_server.models.game_instance import GameInstance
from game_server.models.game import Game
from custom_modules.commands import custom_command_dict
from webtest import TestApp

gid = 'test_gid'
firstpid = '*****@*****.**'
app = TestApp(application(custom_command_dict))
players = [firstpid, '"Bob Jones" <*****@*****.**>', '<*****@*****.**>']


def clear_data_store():
    apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
    stub = datastore_file_stub.DatastoreFileStub('appinvgameserver',
                                                 '/dev/null', '/dev/null')
    apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub)


def make_instance():
    response = app.post('/newinstance', {
        'gid': gid,
        'iid': 'testgame',
        'pid': firstpid
Ejemplo n.º 2
0
def main():
  """Enables a server operation retry wrapper and runs the game server."""
  autoretry_datastore_timeouts()
  run_wsgi_app(application(custom_command_dict))
__authors__ = ['"Bill Magnuson" <*****@*****.**>']

from django.utils import simplejson
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import datastore_file_stub
from google.appengine.ext import db
from google.appengine.ext.db import Key
from game_server.server import application
from game_server.models.game_instance import GameInstance
from game_server.models.game import Game
from custom_modules.commands import custom_command_dict
from webtest import TestApp

gid = 'test_gid'
firstpid = '*****@*****.**'
app = TestApp(application(custom_command_dict))
players = [firstpid, '"Bob Jones" <*****@*****.**>', '<*****@*****.**>']

def clear_data_store():
  apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
  stub = datastore_file_stub.DatastoreFileStub('appinvgameserver',
                                               '/dev/null', '/dev/null')
  apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', stub)

def make_instance():
  response = app.post('/newinstance',
                      {'gid': gid,
                       'iid' : 'testgame',
                       'pid' : firstpid}).json
  assert response['e'] is False
  assert response['request_type'] == '/newinstance'