Skip to content

Commit

Permalink
[#1117] Optimize the reset_db() test helper function
Browse files Browse the repository at this point in the history
This version is faster. Code from @joetsoi
  • Loading branch information
Sean Hammond committed Aug 2, 2013
1 parent f61f319 commit 15daad7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ckan/new_tests/helpers.py
Expand Up @@ -22,11 +22,9 @@ def reset_db():

# Clean out any data from the db. This prevents tests failing due to data
# leftover from other tests or from previous test runs.
model.repo.clean_db()

# Initialize the db. This prevents CKAN from crashing if the tests are run
# and the test db has not been initialized.
model.repo.init_db()
for table in reversed(model.meta.metadata.sorted_tables):
model.meta.Session.execute(table.delete())
model.meta.Session.commit()


def call_action(action_name, context=None, **kwargs):
Expand Down

0 comments on commit 15daad7

Please sign in to comment.