1
0
Fork 0
mirror of https://github.com/shouptech/humulus.git synced 2026-02-03 17:09:44 +00:00

Add $type field

This commit is contained in:
Emma 2019-06-25 15:55:39 -06:00
parent 7f94fabd6d
commit d5e159c9b2
3 changed files with 7 additions and 1 deletions

View file

@ -170,7 +170,8 @@ class RecipeForm(FlaskForm):
'name': self.name.data, 'name': self.name.data,
'efficiency': str(self.efficiency.data), 'efficiency': str(self.efficiency.data),
'volume': str(self.volume.data), 'volume': str(self.volume.data),
'notes': self.notes.data 'notes': self.notes.data,
'$type': 'recipe',
} }
recipe['fermentables'] = [f.doc for f in self.fermentables] recipe['fermentables'] = [f.doc for f in self.fermentables]

View file

@ -40,6 +40,7 @@ def app():
# Add a couple test recipe # Add a couple test recipe
put_doc({ put_doc({
'_id': 'awesome-lager', '_id': 'awesome-lager',
'$type': 'recipe',
'efficiency': '65', 'efficiency': '65',
'name': 'Awesome Lager', 'name': 'Awesome Lager',
'notes': 'Test', 'notes': 'Test',
@ -49,6 +50,7 @@ def app():
}) })
put_doc({ put_doc({
'_id': 'partial-yeast-recipe', '_id': 'partial-yeast-recipe',
'$type': 'recipe',
'efficiency': '75', 'efficiency': '75',
'name': 'Partial Beer', 'name': 'Partial Beer',
'notes': 'Contains only required fields for yeast.', 'notes': 'Contains only required fields for yeast.',
@ -63,6 +65,7 @@ def app():
}) })
put_doc({ put_doc({
'_id': 'full-recipe', '_id': 'full-recipe',
'$type': 'recipe',
'efficiency': '78', 'efficiency': '78',
'name': 'Awesome Beer', 'name': 'Awesome Beer',
'notes': 'This is a test beer that contains most possible fields.', 'notes': 'This is a test beer that contains most possible fields.',

View file

@ -162,6 +162,7 @@ def test_recipe_form_doc(app):
'notes': 'This is a test', 'notes': 'This is a test',
'fermentables': [], 'fermentables': [],
'hops': [], 'hops': [],
'$type': 'recipe',
} }
ferm = FermentableForm() ferm = FermentableForm()
@ -192,6 +193,7 @@ def test_recipe_form_doc(app):
'efficiency': '65', 'efficiency': '65',
'volume': '5.5', 'volume': '5.5',
'notes': 'This is a test', 'notes': 'This is a test',
'$type': 'recipe',
'fermentables': [{ 'fermentables': [{
'name': 'Test', 'name': 'Test',
'type': 'Grain', 'type': 'Grain',