def testCurrentTime(self): SetMonotime(self.advanceTime) cpe_machine = self.getCpe() cpe_machine.Startup() self.wait() self.assertEqual(len(mock_http_clients), 1) ht = mock_http_clients[0] self.assertTrue(ht.fetch_called) root = ET.fromstring(ht.fetch_req.body) ctime = root.find(SOAPNS + 'Body/' + CWMPNS + 'Inform/CurrentTime') self.assertTrue(ctime is not None) self.assertTrue(cwmpdate.valid(ctime.text))
def testCurrentTime(self): SetMonotime(self.advanceTime) cpe_machine = self.getCpe() cpe_machine.Startup() h = self.NextHandler() self.assertEqual(h.request.method, 'POST') root = ET.fromstring(h.request.body) h.finish() ctime = root.find(SOAPNS + 'Body/' + CWMPNS + 'Inform/CurrentTime') self.assertTrue(ctime is not None) self.assertTrue(cwmpdate.valid(ctime.text)) self.assertEqual(len(self.requestlog), 0)
def testValid(self): self.assertTrue(cwmpdate.valid('2009-02-13T23:31:30.987654Z')) self.assertTrue(cwmpdate.valid('2009-02-13T23:31:30Z')) self.assertFalse(cwmpdate.valid('2009-02-13T23:31:30')) self.assertFalse(cwmpdate.valid('booga'))