Commit 2f275f31 by Zia Fazal

fixed scenario when tests run using cached sql schema

parent 7cdeb330
...@@ -186,7 +186,13 @@ def fulfill_course_milestone(course_key, user): ...@@ -186,7 +186,13 @@ def fulfill_course_milestone(course_key, user):
if not settings.FEATURES.get('MILESTONES_APP', False): if not settings.FEATURES.get('MILESTONES_APP', False):
return None return None
from milestones import api as milestones_api from milestones import api as milestones_api
course_milestones = milestones_api.get_course_milestones(course_key=course_key, relationship="fulfills") from milestones.exceptions import InvalidMilestoneRelationshipTypeException
try:
course_milestones = milestones_api.get_course_milestones(course_key=course_key, relationship="fulfills")
except InvalidMilestoneRelationshipTypeException:
# we have not seeded milestone relationship types
seed_milestone_relationship_types()
course_milestones = milestones_api.get_course_milestones(course_key=course_key, relationship="fulfills")
for milestone in course_milestones: for milestone in course_milestones:
milestones_api.add_user_milestone({'id': user.id}, milestone) milestones_api.add_user_milestone({'id': user.id}, milestone)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -28,7 +28,7 @@ DB_CACHE_DIR="common/test/db_cache" ...@@ -28,7 +28,7 @@ DB_CACHE_DIR="common/test/db_cache"
echo "CREATE DATABASE IF NOT EXISTS edxtest;" | mysql -u root echo "CREATE DATABASE IF NOT EXISTS edxtest;" | mysql -u root
# Clear out the test database # Clear out the test database
./manage.py lms --settings bok_choy reset_db --traceback --noinput ./manage.py lms --settings bok_choy flush --traceback --noinput
# If there are cached database schemas/data, load them # If there are cached database schemas/data, load them
if [[ -f $DB_CACHE_DIR/bok_choy_schema.sql && -f $DB_CACHE_DIR/bok_choy_migrations_data.sql && -f $DB_CACHE_DIR/bok_choy_data.json ]]; then if [[ -f $DB_CACHE_DIR/bok_choy_schema.sql && -f $DB_CACHE_DIR/bok_choy_migrations_data.sql && -f $DB_CACHE_DIR/bok_choy_data.json ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment