Skip to content

Instantly share code, notes, and snippets.

@dantimofte
Created January 25, 2019 09:35
Show Gist options
  • Save dantimofte/0d85a6e7f548bf6cf8d68d7a3cea62fe to your computer and use it in GitHub Desktop.
Save dantimofte/0d85a6e7f548bf6cf8d68d7a3cea62fe to your computer and use it in GitHub Desktop.
import os
import pytest
from orderbooks.db_models import OhlcvdataModel
def add_record(session):
new_rec = OhlcvdataModel(
name='bitfinex'
)
session.add(new_rec)
session.commit()
return new_rec
@pytest.fixture()
def test_db(transacted_postgresql_db):
transacted_postgresql_db.create_table(OhlcvdataModel)
transacted_postgresql_db.session.commit()
return transacted_postgresql_db
def test_add_record(test_db):
ohlcv_rec = add_record(test_db.session)
assert type(ohlcv_rec.session_id) == int
assert ohlcv_rec.session_id == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment