| 1 | """Test the example function.""" |
| 2 | |
| 3 | import pytest |
| 4 | |
| 5 | from recurring_ical_events.examples import example_calendar |
| 6 | |
| 7 | |
| 8 | def test_valid_example_is_returned(): |
| 9 | """We can get a valid example.""" |
| 10 | c = example_calendar("fablab_cottbus") |
| 11 | assert c["X-FROM-URL"] == "http://blog.fablab-cottbus.de" |
| 12 | |
| 13 | |
| 14 | def test_we_can_remove_the_ics(): |
| 15 | """We can get a valid example.""" |
| 16 | assert example_calendar("duration") == example_calendar("duration.ics") |
| 17 | |
| 18 | |
| 19 | def test_we_know_which_files_are_ok(): |
| 20 | """The error message shows us which examples to use.""" |
| 21 | with pytest.raises(ValueError) as e: |
| 22 | example_calendar("missing") |
| 23 | assert "issue_4" in str(e.value) |