# Path: eaEmu/db.py
#    def makeMod(modname):
#    def makeClasses(modname, classes):
#    def Join(self, session): # TODO?
#    def Leave(self, session):
#    def getKey(cls, gameName):
#    def _get_login_dirty(self):
#    def _set_login_dirty(self, value):
#    def GetUser(cls, **kw):
#    def CreateUser(name, pwd=None):
#    def addPersona(self, name):
#       def add():
#       def ebAdd(err):
#    def getPersonas(self):
#    def getPersona(self):
#    def _get_umode(self):
#    def _set_umode(self, value):
#    def getChanMode(self, channel):
#    def setChanMode(self, channel, value):
# def modifyMode(mode, mod):
#    def getUser(cls, **kw):
#    def getStats(cls, name, chanName):
#       def dbOps():
#    def dumpFields(self, fields, withNames=False):
# def syncAccount(username):
#    def ebRunQuery(err):
#    def cbRunQuery(result):
#    def __init__(self, *args, **kw):
#    def Login(self, username, pwd):
#       def cbSync(user):
#       def ebSync(err):
#       def ebGetUser(err):
#       def cbGotUser(user):
#       def cbUserAuth(isMatch, user):
#       def ebPlainAuth(err, user):
#          def ebBadPwd(err):
#       def cbCheckNumSessions(user):
#    def getTheater(cls, name):
#    def PlayerLeaveGame(self, session, game_id):
#    def PlayerJoinGame(self, session, game_id):
#    def CreateSession(self, ip, port):
#    def DeleteSession(self, ip, port):
#    def ConnectionEstablished(self, key, user):
#    def ConnectionClosed(self, sess):
#    def GetSession(self, key):
#    def CreateGame(self):
#    def ListGames(self, filters=None):
#    def GetGame(self, game_id=None, host=None):
#    def __init__(self, model):
#    def __call__(self, func):
#       def djangoAsyncWrapper(*args, **kw):
#          def sigSaved(**kw):
# class _GameSessionAspect(object):
# class _GameAspect(object):
# class _UserAspect:
# class _PersonaAspect:
# class _StatsAspect:
# class _LoginSessionAspect(object):
# class _TheaterAspect(object):
# class djangoAsync(object):


from twisted.trial import unittest
from twisted.internet.threads import deferToThread
from twisted.internet import defer
from ..db import Channel, User
from __future__ import absolute_import


class DjangoRaceConditions(unittest.TestCase):
   def setUp(self):
      pass

   def test_getOrCreate(self):

# Path: eaEmu/db.py
#    def makeMod(modname):
#    def makeClasses(modname, classes):
#    def Join(self, session): # TODO?
#    def Leave(self, session):
#    def getKey(cls, gameName):
#    def _get_login_dirty(self):
#    def _set_login_dirty(self, value):
#    def GetUser(cls, **kw):
#    def CreateUser(name, pwd=None):
#    def addPersona(self, name):
#       def add():
#       def ebAdd(err):
#    def getPersonas(self):
#    def getPersona(self):
#    def _get_umode(self):
#    def _set_umode(self, value):
#    def getChanMode(self, channel):
#    def setChanMode(self, channel, value):
# def modifyMode(mode, mod):
#    def getUser(cls, **kw):
#    def getStats(cls, name, chanName):
#       def dbOps():
#    def dumpFields(self, fields, withNames=False):
# def syncAccount(username):
#    def ebRunQuery(err):
#    def cbRunQuery(result):
#    def __init__(self, *args, **kw):
#    def Login(self, username, pwd):
#       def cbSync(user):
#       def ebSync(err):
#       def ebGetUser(err):
#       def cbGotUser(user):
#       def cbUserAuth(isMatch, user):
#       def ebPlainAuth(err, user):
#          def ebBadPwd(err):
#       def cbCheckNumSessions(user):
#    def getTheater(cls, name):
#    def PlayerLeaveGame(self, session, game_id):
#    def PlayerJoinGame(self, session, game_id):
#    def CreateSession(self, ip, port):
#    def DeleteSession(self, ip, port):
#    def ConnectionEstablished(self, key, user):
#    def ConnectionClosed(self, sess):
#    def GetSession(self, key):
#    def CreateGame(self):
#    def ListGames(self, filters=None):
#    def GetGame(self, game_id=None, host=None):
#    def __init__(self, model):
#    def __call__(self, func):
#       def djangoAsyncWrapper(*args, **kw):
#          def sigSaved(**kw):
# class _GameSessionAspect(object):
# class _GameAspect(object):
# class _UserAspect:
# class _PersonaAspect:
# class _StatsAspect:
# class _LoginSessionAspect(object):
# class _TheaterAspect(object):
# class djangoAsync(object):


# Path: eaEmu/test/test_django.py
from twisted.trial import unittest
from twisted.internet.threads import deferToThread
from twisted.internet import defer
from ..db import Channel, User

from __future__ import absolute_import


class DjangoRaceConditions(unittest.TestCase):
   def setUp(self):
      pass

   def test_getOrCreate(self):

      chan = Channel.objects.get(id=1)