import bcrypt
import sys
import os
sys.path.insert(0, "..")
from timpani import database

connection = database.DatabaseConnection()
hashedpassword = bcrypt.hashpw(bytes("password", "utf-8"), bcrypt.gensalt()).decode("utf-8")
user = database.tables.User(username = "tests", password = hashedpassword, full_name = "Timpani Tests", can_change_settings = True, can_write_posts = True)
connection.session.add(user)
connection.session.commit()
connection.close()

import bcrypt
import sys
import os
sys.path.insert(0, "..")
from timpani import database

connection = database.DatabaseConnection()
hashedpassword = bcrypt.hashpw(bytes("password", "utf-8"), bcrypt.gensalt()).decode("utf-8")
user = database.tables.User(username = "tests", password = hashedpassword, full_name = "Timpani Tests", can_change_settings = True, can_write_posts = True)
connection.session.add(user)
connection.session.execute("CREATE INDEX ON sessions(session_id)")
connection.session.commit()
connection.close()

Create index on session_id in order to speed tests
Create index on session_id in order to speed tests

It seems that session querying has been the longest component of all my
tests, and adding one test raised my test time signifigantly. Hopefully
this smooths somet of that out.

  import bcrypt
  import sys
  import os
  sys.path.insert(0, "..")
  from timpani import database
  
  connection = database.DatabaseConnection()
  hashedpassword = bcrypt.hashpw(bytes("password", "utf-8"), bcrypt.gensalt()).decode("utf-8")
  user = database.tables.User(username = "tests", password = hashedpassword, full_name = "Timpani Tests", can_change_settings = True, can_write_posts = True)
  connection.session.add(user)
+ connection.session.execute("CREATE INDEX ON sessions(session_id)")
  connection.session.commit()
  connection.close()
  
Create index on session_id in order to speed tests
## Code Before:
import bcrypt
import sys
import os
sys.path.insert(0, "..")
from timpani import database

connection = database.DatabaseConnection()
hashedpassword = bcrypt.hashpw(bytes("password", "utf-8"), bcrypt.gensalt()).decode("utf-8")
user = database.tables.User(username = "tests", password = hashedpassword, full_name = "Timpani Tests", can_change_settings = True, can_write_posts = True)
connection.session.add(user)
connection.session.commit()
connection.close()

## Instruction:
Create index on session_id in order to speed tests
## Code After:
import bcrypt
import sys
import os
sys.path.insert(0, "..")
from timpani import database

connection = database.DatabaseConnection()
hashedpassword = bcrypt.hashpw(bytes("password", "utf-8"), bcrypt.gensalt()).decode("utf-8")
user = database.tables.User(username = "tests", password = hashedpassword, full_name = "Timpani Tests", can_change_settings = True, can_write_posts = True)
connection.session.add(user)
connection.session.execute("CREATE INDEX ON sessions(session_id)")
connection.session.commit()
connection.close()
