kopia lustrzana https://github.com/biobootloader/wolverine
Fix up test logic
rodzic
4c8e7f7964
commit
507272c4d6
|
@ -1,7 +1,8 @@
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
import tempfile
|
import tempfile
|
||||||
from wolverine import apply_changes
|
from wolverine import apply_changes, json_validated_response
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
|
@ -31,14 +32,14 @@ def test_apply_changes_replace(temp_file):
|
||||||
def test_apply_changes_delete(temp_file):
|
def test_apply_changes_delete(temp_file):
|
||||||
# Make a "delete" change to the third line
|
# Make a "delete" change to the third line
|
||||||
changes = [
|
changes = [
|
||||||
{"operation": "Delete", "line": 3},
|
{"operation": "Delete", "line": 3, "content": ""},
|
||||||
]
|
]
|
||||||
apply_changes(temp_file, changes)
|
apply_changes(temp_file, changes)
|
||||||
|
|
||||||
# Check that the file was updated correctly
|
# Check that the file was updated correctly
|
||||||
with open(temp_file) as f:
|
with open(temp_file) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
assert content == "first line\nsecond line"
|
assert content == "first line\nsecond line\n"
|
||||||
|
|
||||||
|
|
||||||
def test_apply_changes_insert(temp_file):
|
def test_apply_changes_insert(temp_file):
|
||||||
|
@ -51,4 +52,5 @@ def test_apply_changes_insert(temp_file):
|
||||||
# Check that the file was updated correctly
|
# Check that the file was updated correctly
|
||||||
with open(temp_file) as f:
|
with open(temp_file) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
assert content == "first line\nsecond line\ninserted line"
|
assert content == 'first line\nsecond line\ninserted line\nthird line'
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue