Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
db: Add tests for pendingjobs functions
Browse files Browse the repository at this point in the history
Signed-off-by: Major Hayden <[email protected]>
  • Loading branch information
major committed Jul 13, 2018
1 parent 1fe843e commit 70b3535
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,26 @@ def test_commit_testrun(self, mock_sql, mock_log):
# Ensure the data was committed to the database
mock_sql.connect().commit.assert_called()

@mock.patch('sktm.db.sqlite3')
def test_create_pendingjob(self, mock_sql):
"""Ensure create_pending_job() makes a pendingjob record."""
# pylint: disable=W0212,E1101
testdb = SktDb(self.database_file)
mock_sql.connect().cursor().lastrowid = 1
result = testdb.create_pending_job('skt', '2')

self.assertEqual(result, 1)

@mock.patch('sktm.db.sqlite3')
def test_get_pendingjob(self, mock_sql):
"""Ensure get_pending_job_id() retrieves a pendingjob record."""
# pylint: disable=W0212,E1101
testdb = SktDb(self.database_file)
mock_sql.connect().cursor().fetchone.return_value = [1]
result = testdb.get_pending_job_id('skt', '2')

self.assertEqual(result, '1')

@mock.patch('sktm.db.sqlite3')
def test_create_repoid(self, mock_sql):
"""Ensure __create_repoid() inserts into DB and retrieves a repoid."""
Expand Down

0 comments on commit 70b3535

Please sign in to comment.