Skip to content

Commit

Permalink
Fix populate_tables path and attribute order on technologies
Browse files Browse the repository at this point in the history
  • Loading branch information
aalises committed Nov 8, 2018
1 parent 757fdc7 commit 07ebdf2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions api/models/technology.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class TechnologyModel(db.Model):

structure = db.relationship('StructureModel', lazy='dynamic', uselist=True)

def __init__(self, name, description, expansion, age, develops_in, cost, build_time,
applies_to):
def __init__(self, name, expansion, age, develops_in, cost, build_time, applies_to, description):
self.name = name
self.description = description
self.expansion = expansion
Expand Down
Binary file modified db/data.db
Binary file not shown.
4 changes: 2 additions & 2 deletions db/populate_tables.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from numpy import genfromtxt
from os import listdir
import os
from db import db

from api.models.factory import get_model

def populate_db():
for filename in listdir('../data/'):
for filename in os.listdir(os.path.abspath('./data')):
if not filename.endswith('.csv'):
continue

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ flask_sqlalchemy
numpy
python-coveralls
coverage
flasgger
flasgger
pytest
4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def test_create_instances(client):
instance_strct = get_model("structures", ("AmazingStructure", "expansion", "age",
"{'cost':'null'}", 30, 1000, 5, "3/4", "1-8", None, None, None))

instance_tech = get_model("technologies", ("GroundbreakingTech", "description", "expansion", "age",
"develops_in", "{'cost': 'null'}", 30, "Someone"))
instance_tech = get_model("technologies", ("GroundbreakingTech", "expansion", "age", "develops_in",
"{'cost': 'null'}", 30, "Someone", "description"))

assert instance_civ is not None and repr(instance_civ) == "<Civilization: ExampleCiv>"
assert instance_unit is not None and repr(instance_unit) == "<Unit: SampleUnit>"
Expand Down

0 comments on commit 07ebdf2

Please sign in to comment.