Created
January 25, 2019 09:35
-
-
Save dantimofte/0d85a6e7f548bf6cf8d68d7a3cea62fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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