MCPcopy Create free account
hub / github.com/alphagov/notifications-api / _clean_database

Function _clean_database

tests/conftest.py:160–182  ·  view source on GitHub ↗
(_db)

Source from the content-addressed store, hash-verified

158
159
160def _clean_database(_db):
161 _db.session.remove()
162 _db.session_bulk.remove()
163 for tbl in reversed(_db.metadata.sorted_tables):
164 if tbl.name not in [
165 "provider_details",
166 "key_types",
167 "branding_type",
168 "job_status",
169 "provider_details_history",
170 "template_process_type",
171 "notifications_all_time_view",
172 "notification_status_types",
173 "organisation_types",
174 "service_permission_types",
175 "auth_type",
176 "invite_status_type",
177 "service_callback_type",
178 "default_annual_allowance",
179 ]:
180 stmt = delete(tbl)
181 _db.session.execute(stmt)
182 _db.session.commit()
183
184
185# based on https://github.com/sqlalchemy/sqlalchemy/issues/5709#issuecomment-729689097

Callers 2

_notify_dbFunction · 0.85
notify_db_sessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected