Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix fixture and contact mechanism unit test

  • Loading branch information...
commit d0f4d8c9238eaabc4ba8af9d60fead8e0faa7761 1 parent 0c8684e
Erik Janssens authored
View
2  camelot/model/fixture.py
@@ -248,4 +248,4 @@ def set_current_version( cls, fixture_class = None, fixture_version = 0 ):
if not obj:
obj = FixtureVersion( fixture_class = fixture_class )
obj.fixture_version = fixture_version
- Session.object_session( obj ).flush()
+ Session.object_session( obj ).flush()
View
10 camelot/model/party.py
@@ -37,7 +37,7 @@
from sqlalchemy.types import Date, Unicode, Integer, Boolean
from sqlalchemy.sql.expression import and_
-from sqlalchemy import schema, sql, ForeignKey
+from sqlalchemy import orm, schema, sql, ForeignKey
import camelot.types
@@ -233,16 +233,18 @@ def _set_contact_mechanism( self, described_by, value ):
mechanism = contact_mechanism.mechanism
if mechanism != None:
if mechanism[0] == described_by:
- if value:
+ if value and value[1]:
contact_mechanism.mechanism = value
else:
+ session = orm.object_session( party_contact_mechanism )
self.contact_mechanisms.remove( party_contact_mechanism )
+ if party_contact_mechanism.id:
+ session.delete( party_contact_mechanism )
return
- if value:
+ if value and value[1]:
contact_mechanism = ContactMechanism( mechanism = value )
party_contact_mechanism = PartyContactMechanism( contact_mechanism = contact_mechanism )
self.contact_mechanisms.append( party_contact_mechanism )
-
@hybrid.hybrid_property
def email( self ):
View
1  commands.txt
@@ -0,0 +1 @@
+python -m nose.core --with-coverage --cover-html --cover-package=camelot -v -s --with-xunit camelot
View
4 test/__init__.py
@@ -12,7 +12,9 @@ class TestSettings( object ):
def setup_model( self ):
from camelot.core.sql import metadata
- metadata.bind = self.ENGINE()
+ # bind metadata to a specific connection, when using the in memory
+ # database this is needed or the data is lost
+ metadata.bind = self.ENGINE().connect()
from camelot.model import authentication
from camelot.model import party
from camelot.model import i18n
Please sign in to comment.
Something went wrong with that request. Please try again.