Browse Source

clear cache, fix a few glitches in the tests

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
f62c878a53
  1. 22
      pyweb/mumble/MumbleCtlDbus.py
  2. 4
      pyweb/mumble/mctl.py
  3. 3
      pyweb/mumble/models.py
  4. 4
      pyweb/mumble/murmurenvutils.py
  5. 5
      pyweb/mumble/testrunner.py
  6. 2
      pyweb/mumble/tests.py

22
pyweb/mumble/MumbleCtlDbus.py

@ -56,16 +56,32 @@ class MumbleCtlDbus_118(MumbleCtlBase):
return dbus.Interface( dbus.SystemBus().get_object( self.dbus_base, '/%d' % srvid ), 'net.sourceforge.mumble.Murmur' );
def getVersion( self ):
return MumbleCtlDbus_118.convertDbusTypeToNative( self.meta.getVersion() )
return MumbleCtlDbus_118.convertDbusTypeToNative( self.meta.getVersion() );
def getAllConf(self, srvid):
return MumbleCtlDbus_118.convertDbusTypeToNative(self.meta.getAllConf(dbus.Int32(srvid)))
conf = self.meta.getAllConf(dbus.Int32(srvid))
info = {};
for key in conf:
if key == "playername":
info['username'] = conf[key];
else:
info[str(key)] = conf[key];
return info;
def setConf(self, srvid, key, value):
self.meta.setConf(dbus.Int32( srvid ), key, value)
def getDefaultConf(self):
return MumbleCtlDbus_118.convertDbusTypeToNative(self.meta.getDefaultConf())
conf = self.meta.getDefaultConf()
info = {};
for key in conf:
if key == "playername":
info['username'] = conf[key];
else:
info[str(key)] = conf[key];
return info;
def start( self, srvid ):
self.meta.start( srvid );

4
pyweb/mumble/mctl.py

@ -117,5 +117,9 @@ class MumbleCtlBase (object):
MumbleCtlBase.cache[connstring] = ctl;
return ctl;
@staticmethod
def clearCache():
MumbleCtlBase.cache = {};

3
pyweb/mumble/models.py

@ -217,10 +217,7 @@ class Mumble( models.Model ):
self.obfsc = bool( find_in_dicts( 'obfuscate' ) );
pldefault = self._meta.get_field_by_name('player')[0].default;
if self.ctl.getVersion()[:2] == ( 1, 2 ):
self.player = find_in_dicts( ( 'username', 'playername' ), pldefault );
else:
self.player = find_in_dicts( 'playername', pldefault );
chdefault = self._meta.get_field_by_name('channel')[0].default;
self.channel = find_in_dicts( 'channelname', chdefault );

4
pyweb/mumble/murmurenvutils.py

@ -66,9 +66,6 @@ def run_callback( version, callback, *args, **kwargs ):
try:
result = callback( process, *args, **kwargs );
except Exception, err:
raise err;
else:
if type(result) == tuple:
if result[1]:
update_dbase( version );
@ -130,6 +127,7 @@ def run_murmur( version ):
while process.canRead(0.5):
line = process.stdout.readline();
#print "read line:", line
if line == 'DBus registration succeeded\n':
capa.has_dbus = True;
elif line == 'MurmurIce: Endpoint "tcp -h 127.0.0.1 -p 6502" running\n':

5
pyweb/mumble/testrunner.py

@ -69,7 +69,9 @@ def run_mumble_tests( verbosity=1, interactive=True ):
os.environ['MURMUR_CONNSTR'] = connstrings[method];
settings.DEFAULT_CONN = connstrings[method];
settings.SLICE_VERSION = [ int(dgt) for dgt in version.split('.') ];
if not process.capabilities.has_users:
print "Waiting for user to connect (60 seconds)."
wait_for_user( process, timeout=60 );
@ -81,7 +83,10 @@ def run_mumble_tests( verbosity=1, interactive=True ):
failed_tests = 0;
from mctl import MumbleCtlBase
for version in get_available_versions():
MumbleCtlBase.clearCache();
failed_tests += run_callback( version, django_run_tests_wrapper, version );
return failed_tests;

2
pyweb/mumble/tests.py

@ -184,7 +184,7 @@ class DataReading( TestCase ):
self.assert_( hasattr( rule, "deny" ) );
for grp in groups:
if self.murmur.ctl.method == "ICE" and self.murmur.version[:2] == ( 1, 2 ):
if self.murmur.ctl.method == "ICE":
import Murmur
self.assertEquals( type( grp ), Murmur.Group );
else:

Loading…
Cancel
Save