128 self.assertIn('unique_entities_extid_idx', indexes) |
128 self.assertIn('unique_entities_extid_idx', indexes) |
129 self.assertIn('owned_by_relation_p_key', indexes) |
129 self.assertIn('owned_by_relation_p_key', indexes) |
130 self.assertIn('owned_by_relation_to_idx', indexes) |
130 self.assertIn('owned_by_relation_to_idx', indexes) |
131 |
131 |
132 def test_eids_seq_range(self): |
132 def test_eids_seq_range(self): |
133 class MyMassiveObjectStore(MassiveObjectStore): |
133 with self.admin_access.repo_cnx() as cnx: |
134 eids_seq_range = 1000 |
134 store = MassiveObjectStore(cnx, eids_seq_range=1000) |
135 |
|
136 with self.admin_access.repo_cnx() as cnx: |
|
137 store = MyMassiveObjectStore(cnx) |
|
138 store.restart_eid_sequence(50000) |
135 store.restart_eid_sequence(50000) |
139 store.prepare_insert_entity('Location', name=u'toto') |
136 store.prepare_insert_entity('Location', name=u'toto') |
140 store.flush() |
137 store.flush() |
141 cnx.commit() |
138 cnx.commit() |
142 with self.admin_access.repo_cnx() as cnx: |
139 with self.admin_access.repo_cnx() as cnx: |
143 crs = cnx.system_sql("SELECT * FROM entities_id_seq") |
140 crs = cnx.system_sql("SELECT * FROM entities_id_seq") |
144 self.assertGreater(crs.fetchone()[0], 50000) |
141 self.assertGreater(crs.fetchone()[0], 50000) |
145 |
142 |
146 def test_eid_entity(self): |
143 def test_eid_entity(self): |
147 class MyMassiveObjectStore(MassiveObjectStore): |
144 with self.admin_access.repo_cnx() as cnx: |
148 eids_seq_range = 1000 |
145 store = MassiveObjectStore(cnx, eids_seq_range=1000) |
149 |
|
150 with self.admin_access.repo_cnx() as cnx: |
|
151 store = MyMassiveObjectStore(cnx) |
|
152 store.restart_eid_sequence(50000) |
146 store.restart_eid_sequence(50000) |
153 eid = store.prepare_insert_entity('Location', name=u'toto') |
147 eid = store.prepare_insert_entity('Location', name=u'toto') |
154 store.flush() |
148 store.flush() |
155 self.assertGreater(eid, 50000) |
149 self.assertGreater(eid, 50000) |
156 |
150 |