OpenMensa parser for STW Potsdam after canteen website redesign

This commit is contained in:
Falco Duersch
2018-09-19 17:15:34 +02:00
commit e0b88bbc87
17 changed files with 5788 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
# -*- encoding: utf-8 -*-
import io
import json
import os
from stw_potsdam import feed
from stw_potsdam.config import read_canteen_config
def _resource_path(filename):
return os.path.join('tests', 'resources', filename)
def _canteen():
return read_canteen_config()['griebnitzsee']
def _menu():
with open(_resource_path('input.json')) as f:
return json.load(f)
def _expected_feed():
with io.open(_resource_path('output.xml'), encoding='utf-8') as f:
return f.read()
def test_consistency():
canteen = _canteen()
menu = _menu()
actual = feed.render(canteen, menu)
expected = _expected_feed()
assert expected == actual