def CreateGapLease(self): data_file = open('/leases/gap', 'w+') data_file.write(contract_data) data_file.close()def testCreateGapLease(self): contract_writer.CreateGapLease() self.assertEqual(ReadFileContents('/leases/gap'), contract_data)
def testCreateGapLease(self): if os.path.exists(lease_file): RemoveFile(lease_file) ...
def CreateGapLease(self, lease_path=None): if lease_path is None: lease_path = '/leases/gap' ...
def testCreateGapLease(self): lease_file = os.path.join(FLAGS.test_tmpdir, 'gap') contract_writer.CreateGapLease(lease_path=lease_file) self.assertEqual(ReadFileContents(lease_file), contract_data)
/** Return a date object representing the start of the next minute from now */public Date nextMinuteFromNow() { long nowAsMillis = System.currentTimeMillis(); Date then = new Date(nowAsMillis + 60000); then.setSeconds(0); then.setMilliseconds(0); return then;}
public Date minuteAfter(Date now) { Date then = new Date(now.getTime() + 60000); then.setSeconds(0); then.setMilliseconds(0); return then;}// Retain original functionality@Deprecated public Date nextMinuteFromNow() { return minuteAfter(new Date(System.currentTimeMillis()));}
public void testMinuteAfter () { Date now = stringToDate("2012-12-22 11:59:59.999PM"); Date then = minuteAfter(now); assertEquals("2012-12-23 12:00:00.000AM", dateToString(then));}