Skip to content

Commit

Permalink
better mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
wuttinanhi committed Nov 8, 2022
1 parent a765bf8 commit ee88ec8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
6 changes: 3 additions & 3 deletions mock/seed_car.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ def seed_car():
user = UserService.find_by_email("[email protected]")

# mock user car
CarService.add(user, "A11111", "Tesla")
CarService.add(user, "A22222", "Starship")
CarService.add(user, "A33333", "Falcon9")
CarService.add(user, "A-11111", "Tesla Car")
CarService.add(user, "A-22222", "Starship Rocket")
CarService.add(user, "A-33333", "Falcon Nine Rocket")
23 changes: 13 additions & 10 deletions mock/seed_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ def seed_chat():
charlie = UserService.find_by_email("[email protected]")

# mock dummy chat
ChatService.send_chat(annie, bobbie, "1 start Hello Bobbie!")
ChatService.send_chat(bobbie, annie, "2 Hi Annie!")
ChatService.send_chat(annie, bobbie, "3 How are you?")
ChatService.send_chat(bobbie, annie, "4 end I'm good!")

ChatService.send_chat(bobbie, charlie, "1 start Hello Charlie!")
ChatService.send_chat(charlie, bobbie, "2 end Hi Bobbie!")

ChatService.send_chat(annie, charlie, "1 start Hello Charlie!")
ChatService.send_chat(charlie, annie, "2 end Hi Annie!")
# annie -> bobbie
ChatService.send_chat(annie, bobbie, "Hello Bobbie!")
ChatService.send_chat(bobbie, annie, "Hi Annie!")
ChatService.send_chat(annie, bobbie, "Can you move your car?")
ChatService.send_chat(bobbie, annie, "Sure!")

# bobbie -> charlie
ChatService.send_chat(bobbie, charlie, "Hi Charlie!")
ChatService.send_chat(charlie, bobbie, "Hello Bobbie!")

# annie -> charlie
ChatService.send_chat(annie, charlie, "Hello Charlie!")
ChatService.send_chat(charlie, annie, "Hi Annie!")


if __name__ == "__main__":
Expand Down
9 changes: 6 additions & 3 deletions mock/seed_parking_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def seed_parking_lot():

print("Mocking parking lot...")

ParkingLotService.add("Floor 1", True)
ParkingLotService.add("Floor 2", True)
ParkingLotService.add("Floor 3", False)
for building in range(1, 5):
for floor in range(1, 5):
for lot in range(1, 10):
ParkingLotService.add(
f"Building {building} Floor {floor} Lot {lot}", True
)
6 changes: 3 additions & 3 deletions mock/seed_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def seed_reservation():
car_1 = CarService.find_by_id(1)
parking_lot_1 = ParkingLotService.find_by_id(1)

for i in range(1, 11):
parking_date = datetime(year=2022, month=1, day=1, hour=i, minute=0, second=0)
for i in range(1, 5):
parking_date = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)

# mock reservation
reservation = ReservationService.create_reservation(
user, car_1, parking_lot_1, parking_date
)

if i < 10:
if i < 4:
# end created reservation
ReservationService.end_reservation(
reservation, reservation.start_time + timedelta(hours=1)
Expand Down
23 changes: 11 additions & 12 deletions mock/seed_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def seed_user():
"[email protected]",
"root-password",
"root",
"root-firstname",
"root-lastname",
"Root",
"Admin",
"0000000000",
"0000000000000",
)
Expand All @@ -22,29 +22,28 @@ def seed_user():
"[email protected]",
"annie-password",
"annie",
"annie-firstname",
"annie-lastname",
"1111111111",
"Annie",
"Carparker",
"0101234567",
"1111111111111",
)

UserService.register(
"[email protected]",
"bobbie-password",
"bobbie",
"bobbie-firstname",
"bobbie-lastname",
"2222222222",
"Bobbie",
"Carparker",
"0201234567",
"2222222222222",
)

UserService.register(
"[email protected]",
"charlie-password",
"charlie",
"charlie-firstname",
"charlie-lastname",
"3333333333",
"Charlie",
"Carparker",
"0301234567",
"3333333333333",
)

0 comments on commit ee88ec8

Please sign in to comment.