| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | # Copyright (C) 2019 Armin Kuster <akuster808@gmail.com> | 
|  | 2 | # | 
|  | 3 | import re | 
|  | 4 |  | 
|  | 5 | from oeqa.runtime.case import OERuntimeTestCase | 
|  | 6 | from oeqa.core.decorator.depends import OETestDepends | 
|  | 7 | from oeqa.runtime.decorator.package import OEHasPackage | 
|  | 8 |  | 
|  | 9 |  | 
|  | 10 | class ClamavTest(OERuntimeTestCase): | 
|  | 11 |  | 
|  | 12 | @OEHasPackage(['clamav']) | 
|  | 13 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 
|  | 14 | def test_freshclam_help(self): | 
|  | 15 | status, output = self.target.run('freshclam --help ') | 
|  | 16 | msg = ('freshclam --hlep  command does not work as expected. ', | 
|  | 17 | 'Status and output:%s and %s' % (status, output)) | 
|  | 18 | self.assertEqual(status, 0, msg = msg) | 
|  | 19 |  | 
|  | 20 | @OETestDepends(['clamav.ClamavTest.test_freshclam_help']) | 
|  | 21 | def test_freshclam_download(self): | 
|  | 22 | status, output = self.target.run('freshclam --show-progress') | 
|  | 23 | match = re.search('Database updated', output) | 
|  | 24 | #match = re.search('main.cvd is up to date', output) | 
|  | 25 | if not match: | 
|  | 26 | msg = ('freshclam : DB dowbload failed. ' | 
|  | 27 | 'Status and output:%s and %s' % (status, output)) | 
|  | 28 | self.assertEqual(status, 1, msg = msg) | 
|  | 29 |  | 
|  | 30 | @OETestDepends(['clamav.ClamavTest.test_freshclam_download']) | 
|  | 31 | def test_freshclam_check_mirrors(self): | 
|  | 32 | status, output = self.target.run('freshclam --list-mirrors') | 
|  | 33 | match = re.search('Failures: 0', output) | 
|  | 34 | if not match: | 
|  | 35 | msg = ('freshclam --list-mirrors: failed. ' | 
|  | 36 | 'Status and output:%s and %s' % (status, output)) | 
|  | 37 | self.assertEqual(status, 1, msg = msg) | 
|  | 38 |  |