示例#1
0
 def testGvsbServer(self):
   temp = tempfile.NamedTemporaryFile()
   gvsb.GVSBSERVERFILE = temp.name
   gv = gvsb.Gvsb()
   gv.StartTransaction()
   gv.GvsbServer = 'Booga'
   gv.CommitTransaction()
   self.assertEqual(gv.GvsbServer, 'Booga')
   temp.seek(0)
   self.assertEqual(temp.readline(), 'Booga')
   temp.close()
示例#2
0
 def testGvsbKick(self):
   temp = tempfile.NamedTemporaryFile()
   gvsb.GVSBKICKFILE = temp.name
   gv = gvsb.Gvsb()
   gv.StartTransaction()
   gv.GvsbKick = 'kickme'
   gv.CommitTransaction()
   self.assertEqual(gv.GvsbKick, 'kickme')
   temp.seek(0)
   self.assertEqual(temp.readline(), 'kickme')
   temp.close()
示例#3
0
 def testEpgSecondary(self):
   temp = tempfile.NamedTemporaryFile()
   gvsb.EPGSECONDARYFILE = temp.name
   gv = gvsb.Gvsb()
   gv.StartTransaction()
   gv.EpgSecondary = 'Booga'
   gv.CommitTransaction()
   self.assertEqual(gv.EpgSecondary, 'Booga')
   temp.seek(0)
   self.assertEqual(temp.readline(), 'Booga')
   temp.close()
示例#4
0
 def testGvsbChannelLineup(self):
   temp = tempfile.NamedTemporaryFile()
   gvsb.GVSBCHANNELFILE = temp.name
   gv = gvsb.Gvsb()
   self.assertEqual(gv.GvsbChannelLineup, 0)
   gv.StartTransaction()
   gv.GvsbChannelLineup = 1000
   gv.CommitTransaction()
   self.assertEqual(gv.GvsbChannelLineup, 1000)
   temp.seek(0)
   self.assertEqual(temp.readline(), '1000')
   temp.close()
示例#5
0
 def testInitEmptyFiles(self):
   tmpdir = tempfile.mkdtemp()
   gvsb.EPGPRIMARYFILE = os.path.join(tmpdir, 'epgprimaryfile')
   gvsb.EPGSECONDARYFILE = os.path.join(tmpdir, 'epgsecondaryfile')
   gvsb.GVSBSERVERFILE = os.path.join(tmpdir, 'gvsbserverfile')
   gvsb.GVSBCHANNELFILE = os.path.join(tmpdir, 'gvsbchannelfile')
   gvsb.GVSBKICKFILE = os.path.join(tmpdir, 'gvsbkickfile')
   gv = gvsb.Gvsb()
   gv.StartTransaction()
   gv.CommitTransaction()
   self.assertTrue(self._FileIsEmpty(gvsb.EPGPRIMARYFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.EPGSECONDARYFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.GVSBSERVERFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.GVSBCHANNELFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.GVSBKICKFILE))
   shutil.rmtree(tmpdir)
示例#6
0
文件: device.py 项目: prahlad574/my
def PlatformInit(name, device_model_root):
    """Create platform-specific device models and initialize platform."""
    tr.download.INSTALLER = Installer
    params = []
    objects = []
    dev_id = DeviceId()
    periodic_stats = dm.periodic_statistics.PeriodicStatistics()
    device_model_root.Device = Device(dev_id, periodic_stats)
    device_model_root.InternetGatewayDevice = InternetGatewayDevice(
        dev_id, periodic_stats)
    device_model_root.X_GOOGLE_COM_GVSB = gvsb.Gvsb()
    tvrpc = gfibertv.GFiberTv('http://localhost:51834/xmlrpc')
    device_model_root.X_GOOGLE_COM_GFIBERTV = tvrpc
    objects.append('Device')
    objects.append('InternetGatewayDevice')
    objects.append('X_GOOGLE-COM_GVSB')
    objects.append('X_GOOGLE-COM_GFIBERTV')
    return (params, objects)
示例#7
0
 def testAbandonTransaction(self):
   tmpdir = tempfile.mkdtemp()
   gvsb.EPGPRIMARYFILE = os.path.join(tmpdir, 'epgprimaryfile')
   gvsb.EPGSECONDARYFILE = os.path.join(tmpdir, 'epgsecondaryfile')
   gvsb.GVSBSERVERFILE = os.path.join(tmpdir, 'gvsbserverfile')
   gvsb.GVSBCHANNELFILE = os.path.join(tmpdir, 'gvsbchannelfile')
   gvsb.GVSBKICKFILE = os.path.join(tmpdir, 'gvsbkickfile')
   gv = gvsb.Gvsb()
   gv.StartTransaction()
   gv.EpgPrimary = 'epgprimary'
   gv.EpgSecondary = 'epgsecondary'
   gv.GvsbServer = 'gvsbserver'
   gv.GvsbChannelLineup = '1001'
   gv.GvsbKick = 'gvsbkick'
   gv.AbandonTransaction()
   self.assertTrue(self._FileIsEmpty(gvsb.EPGPRIMARYFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.EPGSECONDARYFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.GVSBSERVERFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.GVSBCHANNELFILE))
   self.assertTrue(self._FileIsEmpty(gvsb.GVSBKICKFILE))
   shutil.rmtree(tmpdir)
示例#8
0
 def testValidateExports(self):
   gv = gvsb.Gvsb()
   gv.ValidateExports()