~therve/storm/twisted-integration

« back to all changes in this revision

Viewing changes to tests/store/base.py

  • Committer: Thomas Hervé
  • Date: 2009-05-08 18:02:55 UTC
  • mfrom: (181.1.123 storm.trunk)
  • Revision ID: thomas@canonical.com-20090508180255-26apjwx6c4zh6myn
Merge from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2989
2989
        # Bypass the store to prevent flushing.
2990
2990
        self.assertEquals(self.get_bar_200_title(), "Title 200")
2991
2991
 
 
2992
    def test_reference_wont_touch_store_when_key_is_unset(self):
 
2993
        bar = self.store.get(Bar, 200)
 
2994
        del bar.foo_id
 
2995
        bar.title = u"Don't flush this!"
 
2996
 
 
2997
        self.assertEquals(bar.foo, None)
 
2998
 
 
2999
        # Bypass the store to prevent flushing.
 
3000
        connection = self.store._connection
 
3001
        result = connection.execute("SELECT title FROM bar WHERE id=200")
 
3002
        self.assertEquals(result.get_one()[0], "Title 200")
 
3003
 
2992
3004
    def test_reference_wont_touch_store_with_composed_key_none(self):
2993
3005
        class Bar(object):
2994
3006
            __storm_table__ = "bar"
3177
3189
        self.store.remove(bar)
3178
3190
        self.assertEquals(foo.bar, None)
3179
3191
 
3180
 
    def test_back_reference_on_pending_add(self):
3181
 
        ref1 = SelfRef()
3182
 
        ref2 = SelfRef()
3183
 
        self.store.add(ref1)
3184
 
        self.store.add(ref2)
3185
 
 
3186
 
        ref1.selfref = ref2
3187
 
        # ref2 has not been added to the database yet, but is linked
3188
 
        # to ref1.
3189
 
        self.assertEqual(ref2.id, None)
3190
 
        self.assertEqual(ref2.selfref_on_remote, ref1)
3191
 
 
3192
3192
    def test_reference_loop_with_undefined_keys_fails(self):
3193
3193
        """A loop of references with undefined keys raises OrderLoopError."""
3194
3194
        ref1 = SelfRef()