Example #1
0
    def test_identify_rfu_all_found(self):
        fake_dir = '/tmp/dsadasdadaa/'
        def isfile(path):
            return True

        with patch("os.path.isfile", side_effect=isfile, autospec=True) as if_mock:
            d = identify_rfu(fake_dir)
            self.assertFailure(d, UnknownCMSException)
Example #2
0
    def test_identify_rfu_all_found(self):
        fake_dir = '/tmp/dsadasdadaa/'

        def isfile(path):
            return True

        with patch("os.path.isfile", side_effect=isfile,
                   autospec=True) as if_mock:
            d = identify_rfu(fake_dir)
            self.assertFailure(d, UnknownCMSException)
Example #3
0
    def test_identify_rfu_single_file(self):
        rfu = pu.get_rfu()
        fake_dir = '/tmp/dsadasdadaa/'
        joomla_file = fake_dir + async.filename_encode("media/system/js/validate.js")
        def isfile(path):
            if path == joomla_file:
                return True
            else:
                return False

        with patch("os.path.isfile", side_effect=isfile, autospec=True) as if_mock:
            d = identify_rfu(fake_dir)
            cms_name = self.successResultOf(d)

            self.assertEquals(cms_name, "joomla")
            self.assertEquals(if_mock.call_count, len(rfu))
Example #4
0
    def test_identify_rfu_single_file(self):
        rfu = pu.get_rfu()
        fake_dir = '/tmp/dsadasdadaa/'
        joomla_file = fake_dir + async .filename_encode(
            "media/system/js/validate.js")

        def isfile(path):
            if path == joomla_file:
                return True
            else:
                return False

        with patch("os.path.isfile", side_effect=isfile,
                   autospec=True) as if_mock:
            d = identify_rfu(fake_dir)
            cms_name = self.successResultOf(d)

            self.assertEquals(cms_name, "joomla")
            self.assertEquals(if_mock.call_count, len(rfu))