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()
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()
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()
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()
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)
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)
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)
def testValidateExports(self): gv = gvsb.Gvsb() gv.ValidateExports()