def testParseNameSnapshotObject(self):
     o = SnapshotMock('Test 2011-01-01')
     result = rotatelib.parse_name(o)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2011)
     self.assertEqual(result['date'].month, 1)
     
     o = SnapshotMock('Test 2011-01-01', '2011-01-01T01:30:00.000Z')
     result = rotatelib.parse_name(o)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2011)
     self.assertEqual(result['date'].month, 1)
     self.assertEqual(result['date'].hour, 0)
     
     o = SnapshotMock('Test', '2011-01-01T01:30:00.000Z')
     result = rotatelib.parse_name(o)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2011)
     self.assertEqual(result['date'].month, 1)
     self.assertEqual(result['date'].hour, 1)
     self.assertEqual(result['date'].minute, 30)
     
     # check that snapshot_use_start_time prefers the start_time
     o = SnapshotMock('Test 2011-02-01', '2011-01-01T01:30:00.000Z')
     result = rotatelib.parse_name(o, snapshot_use_start_time=True)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2011)
     self.assertEqual(result['date'].month, 1)
     self.assertEqual(result['date'].hour, 1)
     self.assertEqual(result['date'].minute, 30)
     
     # check that prefers description
     o = SnapshotMock('Test 2011-02-01', '2011-01-01T01:30:00.000Z')
     result = rotatelib.parse_name(o, snapshot_use_start_time=False)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2011)
     self.assertEqual(result['date'].month, 2)
     self.assertEqual(result['date'].hour, 0)
Exemple #2
0
    def testParseNameSnapshotObject(self):
        o = SnapshotMock('Test 2011-01-01')
        result = rotatelib.parse_name(o)
        self.assertTrue(result['date'])
        self.assertEqual(result['date'].year, 2011)
        self.assertEqual(result['date'].month, 1)

        o = SnapshotMock('Test 2011-01-01', '2011-01-01T01:30:00.000Z')
        result = rotatelib.parse_name(o)
        self.assertTrue(result['date'])
        self.assertEqual(result['date'].year, 2011)
        self.assertEqual(result['date'].month, 1)
        self.assertEqual(result['date'].hour, 0)

        o = SnapshotMock('Test', '2011-01-01T01:30:00.000Z')
        result = rotatelib.parse_name(o)
        self.assertTrue(result['date'])
        self.assertEqual(result['date'].year, 2011)
        self.assertEqual(result['date'].month, 1)
        self.assertEqual(result['date'].hour, 1)
        self.assertEqual(result['date'].minute, 30)

        # check that snapshot_use_start_time prefers the start_time
        o = SnapshotMock('Test 2011-02-01', '2011-01-01T01:30:00.000Z')
        result = rotatelib.parse_name(o, snapshot_use_start_time=True)
        self.assertTrue(result['date'])
        self.assertEqual(result['date'].year, 2011)
        self.assertEqual(result['date'].month, 1)
        self.assertEqual(result['date'].hour, 1)
        self.assertEqual(result['date'].minute, 30)

        # check that prefers description
        o = SnapshotMock('Test 2011-02-01', '2011-01-01T01:30:00.000Z')
        result = rotatelib.parse_name(o, snapshot_use_start_time=False)
        self.assertTrue(result['date'])
        self.assertEqual(result['date'].year, 2011)
        self.assertEqual(result['date'].month, 2)
        self.assertEqual(result['date'].hour, 0)
 def testParseName3(self):
     f = 'test-20090629.bz2'
     result = rotatelib.parse_name(f)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2009)
     self.assertEqual(result['date'].month, 6)
 def testParseName2(self):
     f = 'test-2009-06-29T14-0700.bz2'
     result = rotatelib.parse_name(f)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2009)
     self.assertEqual(result['date'].month, 6)
Exemple #5
0
 def testParseName3(self):
     f = 'test-20090629.bz2'
     result = rotatelib.parse_name(f)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2009)
     self.assertEqual(result['date'].month, 6)
Exemple #6
0
 def testParseName2(self):
     f = 'test-2009-06-29T14-0700.bz2'
     result = rotatelib.parse_name(f)
     self.assertTrue(result['date'])
     self.assertEqual(result['date'].year, 2009)
     self.assertEqual(result['date'].month, 6)