def create_test_user(user_dict): u = User(_id=user_dict['id'], name=user_dict['phone'], _is_test_user=True) u.password = TEST_USER_PASSWORD u.role = User.Role.tower.value u.active = True for k in user_dict.keys(): setattr(u, k, user_dict[k]) u.update_position(user_dict['last_lat_seen'], user_dict['last_long_seen']) logger.debug("created test user: {}".format(User.query.get(u.id))) return u
def run(): print("Creating new users") mark = User(_id='Mark', name='Mark') mark.password = '******' mark.phone = "8139577566" mark.is_android = True mark.update_position(38.997144, -77.12401) # DC mark.role = User.Role.tower.value adam = User(_id='Adam', name='Adam') adam.password = '******' adam.phone = "3475563921" adam.is_android = True adam.role = User.Role.tower.value adam.update_position(40.727328, -73.9876522) # NYC brent = User(_id='Brent', name='Brent') brent.password = '******' brent.phone = "5613061883" brent.is_android = True brent.role = User.Role.tower.value brent.update_position(30.4670643, -84.3972845) # Tallahasse # rayna = User(_id='rayna', name='rayna') # rayna.password = '******' # rayna.phone = "5613061883" # rayna.is_android = True # rayna.role = User.Role.tower.value # rayna.update_position(28.359309, -82.66591) # Tampa db.session.merge(adam) db.session.merge(mark) db.session.merge(brent) # db.session.merge(rayna) db.session.commit() print("Successfully created users :)")