Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21 from uber/fix/ca/add_get_from_db_test
Browse files Browse the repository at this point in the history
Add a test to get from database
  • Loading branch information
charlax committed Jan 22, 2014
2 parents 81e3a82 + a863686 commit 3b3127e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charlatan/tests/data/relationships.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ relationship_alone:
fields:
name: "red"
model: charlatan.tests.fixtures.models:Color

from_database:
id: 1
model: charlatan.tests.fixtures.models:Toaster
10 changes: 10 additions & 0 deletions charlatan/tests/test_sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def setUp(self):

def tearDown(self):
Base.metadata.drop_all(engine)
self.session.close()

def test_double_install(self):
"""Verify that there's no double install."""
Expand All @@ -23,3 +24,12 @@ def test_double_install(self):

self.assertEqual(self.session.query(Toaster).count(), 1)
self.assertEqual(self.session.query(Color).count(), 1)

def test_getting_from_database(self):
"""Verify that we can get from the database."""
installed = Toaster(id=1)
self.session.add(installed)
self.session.commit()

toaster = self.manager.install_fixture("from_database")
self.assertEqual(toaster.id, 1)

0 comments on commit 3b3127e

Please sign in to comment.