mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
add test_popupdate.py
We had no coverage over aurweb.scripts.popupdate. This test covers all of its functionality. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
4b7609681d
commit
6d08789ac1
3 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
import math
|
||||
|
||||
try:
|
||||
import mysql.connector
|
||||
except ImportError:
|
||||
|
@ -95,6 +97,7 @@ class Connection:
|
|||
elif aur_db_backend == 'sqlite':
|
||||
aur_db_name = aurweb.config.get('database', 'name')
|
||||
self._conn = sqlite3.connect(aur_db_name)
|
||||
self._conn.create_function("POWER", 2, math.pow)
|
||||
self._paramstyle = sqlite3.paramstyle
|
||||
else:
|
||||
raise ValueError('unsupported database backend')
|
||||
|
|
|
@ -7,7 +7,6 @@ import aurweb.db
|
|||
|
||||
def main():
|
||||
conn = aurweb.db.Connection()
|
||||
|
||||
conn.execute("UPDATE PackageBases SET NumVotes = (" +
|
||||
"SELECT COUNT(*) FROM PackageVotes " +
|
||||
"WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
|
||||
|
|
5
test/test_popupdate.py
Normal file
5
test/test_popupdate.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from aurweb.scripts import popupdate
|
||||
|
||||
|
||||
def test_popupdate():
|
||||
popupdate.main()
|
Loading…
Add table
Reference in a new issue