# -*- coding: utf-8 -*-1# This program is free software; you can redistribute it and/or modify2# it under the terms of the GNU General Public License as published by3# the Free Software Foundation; either version 2 of the License, or4# (at your option) any later version.5#6# This program is distributed in the hope that it will be useful,7# but WITHOUT ANY WARRANTY; without even the implied warranty of8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9# GNU General Public License for more details.10#11# You should have received a copy of the GNU General Public License12# along with this program; if not, write to the Free Software13# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,14# MA 02110-1301, USA.15#16# Author: Mauro Soria1718from unittest import TestCase1920from lib.utils.diff import DynamicContentParser, generate_matching_regex212223class TestDiff(TestCase):24def test_generate_matching_regex(self):25self.assertEqual(generate_matching_regex("add.php", "abc.php"), "^a.*\\.php$", "Matching regex isn't correct")2627def test_dynamic_content_parser(self):28self.assertEqual(DynamicContentParser("a b c", "a b d")._static_patterns, ["a", "b"], "Static patterns are not right")29self.assertTrue(DynamicContentParser("abc.php not found", "def.php not found").compare_to("nothing.php not found"))30self.assertTrue(DynamicContentParser("abc.php not found", "def.php not found").compare_to("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.php not found"))313233