def test_file_contains_lines_returns_false(self):
        with mock.patch(
                '__builtin__.open',
                self.mock_open("line 1\n line2\n line3")):

            self.assertFalse(
                utils.file_contains_lines('/some/path', ['line 4', 'line3']))
Esempio n. 2
0
    def test_file_contains_lines_returns_false(self):
        with mock.patch(
                '__builtin__.open',
                self.mock_open("line 1\n line2\n line3")):

            self.assertFalse(
                utils.file_contains_lines('/some/path', ['line 4', 'line3']))
 def check_if_required(self):
     """Let's assume that we require this hack if default yum provider
     doesn't contain ``rpm_versioncmp`` function.
     """
     patched = file_contains_lines(
         os.path.join(self.puppet, self.destination),
         ['rpm_versioncmp'])
     version = self.config.from_version in ('5.0', '5.0.1')
     return not patched and version
Esempio n. 4
0
    def verify_postgres_dump(self):
        """Checks that postgresql dump is correct
        """
        if not os.path.exists(self.pg_dump_path):
            return False
        patterns = [
            '-- PostgreSQL database cluster dump',
            '-- PostgreSQL database dump',
            '-- PostgreSQL database dump complete',
            '-- PostgreSQL database cluster dump complete']

        return utils.file_contains_lines(self.pg_dump_path, patterns)
Esempio n. 5
0
    def verify_postgres_dump(self):
        """Checks that postgresql dump is correct
        """
        if not os.path.exists(self.pg_dump_path):
            return False
        patterns = [
            '-- PostgreSQL database cluster dump',
            '-- PostgreSQL database dump',
            '-- PostgreSQL database dump complete',
            '-- PostgreSQL database cluster dump complete'
        ]

        return utils.file_contains_lines(self.pg_dump_path, patterns)