1
0
mirror of https://github.com/balkian/bitter.git synced 2025-08-30 07:12:20 +00:00

Compose and bug fixes

This commit is contained in:
J. Fernando Sánchez
2018-03-19 14:36:05 +01:00
parent 53bb7edabc
commit 6259013978
9 changed files with 80 additions and 29 deletions

23
tests/test_models.py Normal file
View File

@@ -0,0 +1,23 @@
from unittest import TestCase
import os
import types
from bitter import utils
from bitter.models import *
from sqlalchemy import exists
class TestModels(TestCase):
def setUp(self):
self.session = make_session('sqlite://')
def test_user(self):
fake_user = User(name="Fake user", id=1548)
self.session.add(fake_user)
self.session.commit()
fake_committed = self.session.query(User).filter_by(name="Fake user").first()
assert fake_committed
self.session.delete(fake_committed)
self.session.commit()
assert not list(self.session.execute('SELECT 1 from users where id=\'%s\'' % 1548))