OpenMensa parser for STW Potsdam after canteen website redesign
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user