mock.sentinel._connection

Here are the examples of the python api mock.sentinel._connection taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: firefox-flicks Source File: test_mongodb.py
Function: test_get_connection_connection_exists
    def test_get_connection_connection_exists(self):

        with patch('pymongo.connection.Connection') as mock_Connection:
            self.backend._connection = sentinel._connection

            connection = self.backend._get_connection()

            self.assertEquals(sentinel._connection, connection)
            self.assertFalse(mock_Connection.called)

Example 2

Project: make.mozilla.org Source File: test_mongodb.py
Function: test_get_connection_connection_exists
    def test_get_connection_connection_exists(self):

        @patch("pymongo.connection.Connection")
        def do_test(mock_Connection):
            self.backend._connection = sentinel._connection

            connection = self.backend._get_connection()

            self.assertEquals(sentinel._connection, connection)
            self.assertFalse(mock_Connection.called)
        do_test()