Ejemplo n.º 1
0
 def setUp(self):
     db.create_all()
     snack1 = Snack("Hershey", "Chocolate")
     snack2 = Snack("Skittles", "Candy")
     snack3 = Snack("Chips Ahoy", "Cookie")
     db.session.add_all([snack1, snack2, snack3])
     db.session.commit()
Ejemplo n.º 2
0
 def setUp(self):
     db.create_all()
     joe = User("Joe", "Bloggs")
     maria = User("Maria", "Rossi")
     fulan = User("Fulan", "AlFulani")
     taro = User("Taro", "Yamada")
     db.session.add_all([joe, maria, fulan, taro])
     weather = Message("The weather is nice today", 1)
     life = Message(
         "Do not take life too seriously. You will never get out of it alive.",
         1)
     brain = Message(
         "Maybe if we tell people the brain is an app, they'll start using it.",
         1)
     italy = Message("I love Italy!", 2)
     arabic = Message(
         "Arabic has 11 words for love, and hundreds for camel.", 3)
     dancing = Message(
         "Late-night dancing was illegal in Japan until 2015.", 4)
     adoption = Message(
         '98% of adoptions in Japan are of adult men to keep businesses "in the family."',
         4)
     db.session.add_all(
         [weather, life, brain, italy, arabic, dancing, adoption])
     db.session.commit()
Ejemplo n.º 3
0
 def setUp(self):
     db.create_all()
     user1 = User("Elie", "Schoppik")
     user2 = User("Tim", "Garcia")
     user3 = User("Matt", "Lane")
     db.session.add_all([user1, user2, user3])
     message1 = Message("Hello Elie!!", 1)
     message2 = Message("Goodbye Elie!!", 1)
     message3 = Message("Hello Tim!!", 2)
     message4 = Message("Goodbye Tim!!", 2)
     db.session.add_all([message1, message2, message3, message4])
     db.session.commit()
Ejemplo n.º 4
0
from solution import db, User, Message

# Create tables and database
db.create_all()

# Create users

joe = User("Joe", "Bloggs")
maria = User("Maria", "Rossi")
fulan = User("Fulan", "AlFulani")
taro = User("Taro", "Yamada")

# Create messages

weather = Message("The weather is nice today", 1)
life = Message(
    "Do not take life too seriously. You will never get out of it alive.", 1)
brain = Message(
    "Maybe if we tell people the brain is an app, they'll start using it.", 1)
italy = Message("I love Italy!", 2)
arabic = Message("Arabic has 11 words for love, and hundreds for camel.", 3)
japan = Message("Late-night dancing was illegal in Japan until 2015.", 4)

db.session.add_all([joe, maria, fulan, taro])
db.session.add_all([weather, life, brain, italy, arabic, japan])
db.session.commit()