# Path: norm/sqlite.py
# class SqliteCursorWrapper(object):
#     """
#     I wrap an IAsyncCursor but do SQLiteish things with it.
#     """
# 
#     implements(IAsyncCursor)
# 
# 
#     def __init__(self, cursor):
#         """
#         @param cursor: An L{IAsyncCursor} implementing cursor.
#         """
#         self.cursor = cursor
# 
# 
#     def execute(self, *args, **kwargs):
#         return self.cursor.execute(*args, **kwargs)
# 
# 
#     def fetchone(self):
#         return self.cursor.fetchone()
# 
# 
#     def fetchall(self):
#         return self.cursor.fetchall()
# 
# 
#     def lastRowId(self):
#         return self.cursor.lastRowId()
# 
# 
#     def close(self):
#         return self.cursor.close()
# 
# Path: norm/interface.py
# class IAsyncCursor(Interface):
# 
# 
#     def execute(query, params=None):
#         """
#         Execute the given sql and params.
# 
#         Return a C{Deferred} which will fire with the DB-API results.
#         """
# 
# 
#     def fetchone():
#         pass
# 
# 
#     def fetchall():
#         pass
# 
# 
#     def lastRowId():
#         """
#         Return a C{Deferred} id of the most recently inserted row.
#         """
# 
# 
#     def close():
#         pass


from twisted.trial.unittest import TestCase
from twisted.internet import defer
from zope.interface.verify import verifyObject
from mock import MagicMock
from norm.sqlite import SqliteCursorWrapper
from norm.interface import IAsyncCursor
# Copyright (c) Matt Haggard.
# See LICENSE for details.





class SqliteCursorWrapperTest(TestCase):


    def test_IAsyncCursor(self):
        verifyObject(IAsyncCursor, SqliteCursorWrapper(None))


    def assertCallThrough(self, name, *args, **kwargs):
        mock = MagicMock()
        setattr(mock, name, MagicMock(return_value=defer.succeed('foo')))


# Path: norm/sqlite.py
# class SqliteCursorWrapper(object):
#     """
#     I wrap an IAsyncCursor but do SQLiteish things with it.
#     """
# 
#     implements(IAsyncCursor)
# 
# 
#     def __init__(self, cursor):
#         """
#         @param cursor: An L{IAsyncCursor} implementing cursor.
#         """
#         self.cursor = cursor
# 
# 
#     def execute(self, *args, **kwargs):
#         return self.cursor.execute(*args, **kwargs)
# 
# 
#     def fetchone(self):
#         return self.cursor.fetchone()
# 
# 
#     def fetchall(self):
#         return self.cursor.fetchall()
# 
# 
#     def lastRowId(self):
#         return self.cursor.lastRowId()
# 
# 
#     def close(self):
#         return self.cursor.close()
# 
# Path: norm/interface.py
# class IAsyncCursor(Interface):
# 
# 
#     def execute(query, params=None):
#         """
#         Execute the given sql and params.
# 
#         Return a C{Deferred} which will fire with the DB-API results.
#         """
# 
# 
#     def fetchone():
#         pass
# 
# 
#     def fetchall():
#         pass
# 
# 
#     def lastRowId():
#         """
#         Return a C{Deferred} id of the most recently inserted row.
#         """
# 
# 
#     def close():
#         pass


# Path: norm/test/test_sqlite.py
from twisted.trial.unittest import TestCase
from twisted.internet import defer
from zope.interface.verify import verifyObject
from mock import MagicMock
from norm.sqlite import SqliteCursorWrapper
from norm.interface import IAsyncCursor

# Copyright (c) Matt Haggard.
# See LICENSE for details.





class SqliteCursorWrapperTest(TestCase):


    def test_IAsyncCursor(self):
        verifyObject(IAsyncCursor, SqliteCursorWrapper(None))


    def assertCallThrough(self, name, *args, **kwargs):
        mock = MagicMock()
        setattr(mock, name, MagicMock(return_value=defer.succeed('foo')))


        cursor = SqliteCursorWrapper(mock)