Beispiel #1
0
def apply_patches_kinesalite():
    files = [
        "%s/node_modules/kinesalite/validations/decreaseStreamRetentionPeriod.js",
        "%s/node_modules/kinesalite/validations/increaseStreamRetentionPeriod.js",
    ]
    for file_path in files:
        file_path = file_path % MODULE_MAIN_PATH
        replace_in_file("lessThanOrEqual: 168", "lessThanOrEqual: 8760", file_path)
Beispiel #2
0
def apply_patches_kinesalite():
    files = [
        "%s/kinesalite/validations/decreaseStreamRetentionPeriod.js",
        "%s/kinesalite/validations/increaseStreamRetentionPeriod.js",
    ]
    for file_path in files:
        file_path = file_path % install.INSTALL_DIR_NPM
        replace_in_file("lessThanOrEqual: 168", "lessThanOrEqual: 8760",
                        file_path)
Beispiel #3
0
    def test_replace_in_file(self, tmp_path):
        content = """
        1: {search}
        2: {search}
        3: {sear}
        """
        expected = """
        1: foo
        2: foo
        3: {sear}
        """

        fp = tmp_path / "file.txt"
        fp.write_text(content)

        common.replace_in_file("{search}", "foo", fp)
        assert fp.read_text() == expected

        # try again, nothing should change
        common.replace_in_file("{search}", "foo", fp)
        assert fp.read_text() == expected
Beispiel #4
0
    def test_replace_in_file_with_non_existing_path(self, tmp_path):
        fp = tmp_path / "non_existing_file.txt"

        assert not fp.exists()
        common.replace_in_file("foo", "bar", fp)
        assert not fp.exists()