Mike Bayer avatar Mike Bayer committed 4f9a7ab

more tests

Comments (0)

Files changed (1)

test/orm/dynamic.py

         sess.flush()
 
         assert testing.db.execute(select([addresses]).where(addresses.c.user_id!=None)).fetchall() == [
-            (1, u1.id, 'foo')
+            (a1.id, u1.id, 'foo')
         ]
         
         u1.addresses.remove(a1)
         sess.flush()
         assert testing.db.scalar(select([func.count(1)]).where(addresses.c.user_id!=None)) == 0
         
-        
+        u1.addresses.append(a1)
+        sess.flush()
+        assert testing.db.execute(select([addresses]).where(addresses.c.user_id!=None)).fetchall() == [
+            (a1.id, u1.id, 'foo')
+        ]
+
+        a2= Address(email_address='bar')
+        u1.addresses.remove(a1)
+        u1.addresses.append(a2)
+        sess.flush()
+        assert testing.db.execute(select([addresses]).where(addresses.c.user_id!=None)).fetchall() == [
+            (a2.id, u1.id, 'bar')
+        ]
         
         
     @testing.resolve_artifact_names
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.