Commit a3760209 authored by Kevin Morris's avatar Kevin Morris Committed by Lukas Fleischer
Browse files

add test_popupdate.py



We had no coverage over aurweb.scripts.popupdate. This test covers
all of its functionality.
Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 3b7ebc76
import math
try: try:
import mysql.connector import mysql.connector
except ImportError: except ImportError:
...@@ -91,6 +93,7 @@ class Connection: ...@@ -91,6 +93,7 @@ class Connection:
elif aur_db_backend == 'sqlite': elif aur_db_backend == 'sqlite':
aur_db_name = aurweb.config.get('database', 'name') aur_db_name = aurweb.config.get('database', 'name')
self._conn = sqlite3.connect(aur_db_name) self._conn = sqlite3.connect(aur_db_name)
self._conn.create_function("POWER", 2, math.pow)
self._paramstyle = sqlite3.paramstyle self._paramstyle = sqlite3.paramstyle
else: else:
raise ValueError('unsupported database backend') raise ValueError('unsupported database backend')
......
...@@ -7,7 +7,6 @@ import aurweb.db ...@@ -7,7 +7,6 @@ import aurweb.db
def main(): def main():
conn = aurweb.db.Connection() conn = aurweb.db.Connection()
conn.execute("UPDATE PackageBases SET NumVotes = (" + conn.execute("UPDATE PackageBases SET NumVotes = (" +
"SELECT COUNT(*) FROM PackageVotes " + "SELECT COUNT(*) FROM PackageVotes " +
"WHERE PackageVotes.PackageBaseID = PackageBases.ID)") "WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
......
from aurweb.scripts import popupdate
def test_popupdate():
popupdate.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment