Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaponte committed Mar 10, 2022
1 parent 58a97c6 commit b0bc591
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions invisible_cities/database/download_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,27 @@ def test_create_table_sqlite(dbname, output_tmpdir):

for table in db.tables:
db.create_table_sqlite(cursorSqlite, cursorMySql, table)


@mark.parametrize('dbname', db.dbnames)
def test_table_assignment(dbname):
for name in db.common_tables:
assert name in db.table_dict[dbname]

for name in db.extended.get(dbname, ()):
assert name in db.table_dict[dbname]


@mark.parametrize('dbname', db.dbnames)
def test_existing_tables(dbname):
connMySql = pymysql.connect(host="neutrinos1.ific.uv.es",
user='nextreader',passwd='readonly', db=dbname)

cursor = connMySql.cursor()
cursor.execute("Show tables;")
available = cursor.fetchall()

for name in db.table_dict[dbname]:
assert (name,) in available


0 comments on commit b0bc591

Please sign in to comment.