Skip to content

Commit

Permalink
Added seed (part 6)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhea0 committed Oct 3, 2017
1 parent c3b64c0 commit 9521c34
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions manage.py
Expand Up @@ -61,5 +61,25 @@ def recreate_db():
db.session.commit()


@manager.command
def seed_db():
"""Seeds the database."""
db.session.add(Exercise(
exercise_body='Define a function called sum that takes two integers as arguments and returns their sum.',
test_code='print(sum(2, 3))',
test_code_solution='5'
))
db.session.add(Exercise(
exercise_body='Define a function called reverse that takes a string as an argument and returns the string in reversed order.',
test_code='print(reverse(racecar))',
test_code_solution='racecar'
))
db.session.add(Exercise(
exercise_body='Define a function called factorial that takes a random number as an argument and then returns the factorial of that given number.',
test_code='print(factorial(5))',
test_code_solution='120'
))
db.session.commit()

if __name__ == '__main__':
manager.run()

0 comments on commit 9521c34

Please sign in to comment.