Test the regex for journald_clean()
(self)
| 508 | raise rte |
| 509 | |
| 510 | def test_journald_regex(self): |
| 511 | """Test the regex for journald_clean()""" |
| 512 | positive_cases = ('Vacuuming done, freed 0B of archived journals on disk.', |
| 513 | 'Vacuuming done, freed 1K of archived journals on disk.', |
| 514 | 'Vacuuming done, freed 100.0M of archived journals on disk.', |
| 515 | 'Vacuuming done, freed 1G of archived journals on disk.', |
| 516 | 'Vacuuming done, freed 0B of archived journals from /run/log/journal.', |
| 517 | 'Vacuuming done, freed 1.0G of archived journals from /var/log/journal/123abc.') |
| 518 | regex = re.compile(JOURNALD_REGEX) |
| 519 | for pos in positive_cases: |
| 520 | self.assertTrue(regex.match(pos)) |
| 521 | negative_cases = ('Deleted archived journal /var/log/journal/123/system@123-123.journal~ (56.0M).', |
| 522 | 'Archived and active journals take up 100.0M on disk.') |
| 523 | for neg in negative_cases: |
| 524 | self.assertFalse(regex.match(neg)) |
| 525 | |
| 526 | def test_get_purgeable_locales(self): |
| 527 | """Unit test for method get_purgeable_locales()""" |