示例#1
0
文件: test_db.py 项目: danghai/sktm
    def test_last_pending_patch_missing(self, mock_sql):
        """Ensure None is returned when no patches match."""
        testdb = SktDb(self.database_file)
        mock_sql.connect().cursor().fetchone.return_value = None
        result = testdb.get_last_pending_patch('baseurl', 'project_id')

        self.assertIsNone(result)
示例#2
0
文件: test_db.py 项目: danghai/sktm
    def test_last_pending_patch(self, mock_sql):
        """Ensure get_last_pending_patch() returns a patch id."""
        testdb = SktDb(self.database_file)
        mock_sql.connect().cursor().fetchone.return_value = [1]
        result = testdb.get_last_pending_patch('baseurl', 'project_id')

        self.assertEqual(result, 1)