Skip to content

Commit

Permalink
Revert "Fix migrations tests"
Browse files Browse the repository at this point in the history
This reverts commit 1386d02.
  • Loading branch information
bitphage committed Aug 21, 2019
1 parent 5684600 commit cdabb62
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion tests/migrations/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,49 @@
import tempfile
import logging

from sqlalchemy import create_engine
from sqlalchemy import create_engine, Column, String, Integer, Float
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

log = logging.getLogger("dexbot")
log.setLevel(logging.DEBUG)

Base = declarative_base()

# Classes are represent initial table structure


class Config(Base):
__tablename__ = 'config'

id = Column(Integer, primary_key=True)
category = Column(String)
key = Column(String)
value = Column(String)


class Orders(Base):
__tablename__ = 'orders'

id = Column(Integer, primary_key=True)
worker = Column(String)
order_id = Column(String)
order = Column(String)


class Balances(Base):
__tablename__ = 'balances'

id = Column(Integer, primary_key=True)
account = Column(String)
worker = Column(String)
base_total = Column(Float)
base_symbol = Column(String)
quote_total = Column(Float)
quote_symbol = Column(String)
center_price = Column(Float)
timestamp = Column(Integer)


@pytest.fixture
def initial_db():
Expand All @@ -17,6 +54,7 @@ def initial_db():
engine = create_engine('sqlite:///{}'.format(db_file), echo=False)
Session = sessionmaker(bind=engine)
session = Session()
Base.metadata.create_all(engine)
session.commit()
log.debug('Prepared db on {}'.format(db_file))

Expand Down

0 comments on commit cdabb62

Please sign in to comment.