You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
862 B

5 years ago
5 years ago
5 years ago
  1. import pytest
  2. from pathlib import Path
  3. from tibi_hardlinks.backup_parser import parse_property_text
  4. # random_data fixture
  5. # sample data fixture
  6. @pytest.mark.usefixtures("canned_data_input", "canned_data_output")
  7. @pytest.mark.parametrize("filename", [("example-new"), ("example-old")])
  8. def test_canned_data(filename, canned_data_input, canned_data_output):
  9. data = canned_data_input(filename)
  10. expected_output = canned_data_output(filename)
  11. experimental = parse_property_text(data)
  12. for key, value in expected_output.items():
  13. assert experimental[key] == value
  14. @pytest.mark.parametrize(
  15. "property_filepath", Path("../test_data/mock_backup_data").glob("*.properties")
  16. )
  17. def test_parser_no_errors(property_filepath):
  18. with open(property_filepath) as property_file:
  19. data = property_file.read()
  20. parse_property_text(data)