Ejemplo n.º 1
0
 def test_get_non_existent_key(self):
     x = CouchBackend(app=self.app)
     x._connection = Mock()
     get = x._connection.get = MagicMock()
     get.side_effect = pycouchdb.exceptions.NotFound
     assert x.get('1f3fab') is None
     x._connection.get.assert_called_once_with('1f3fab')
Ejemplo n.º 2
0
 def test_get_non_existent_key(self):
     x = CouchBackend(app=self.app)
     x._connection = Mock()
     get = x._connection.get = MagicMock()
     get.side_effect = pycouchdb.exceptions.NotFound
     assert x.get('1f3fab') is None
     x._connection.get.assert_called_once_with('1f3fab')
Ejemplo n.º 3
0
    def test_get(self):
        """test_get

        CouchBackend.get should return  and take two params
        db conn to couchdb is mocked.
        """
        x = CouchBackend(app=self.app)
        x._connection = Mock()
        get = x._connection.get = MagicMock()
        assert x.get('1f3fab') == get.return_value['value']
        x._connection.get.assert_called_once_with('1f3fab')
Ejemplo n.º 4
0
    def test_get(self):
        """test_get

        CouchBackend.get should return  and take two params
        db conn to couchdb is mocked.
        """
        x = CouchBackend(app=self.app)
        x._connection = Mock()
        get = x._connection.get = MagicMock()
        assert x.get('1f3fab') == get.return_value['value']
        x._connection.get.assert_called_once_with('1f3fab')
Ejemplo n.º 5
0
    def test_get(self):
        """test_get

        CouchBackend.get should return  and take two params
        db conn to couchdb is mocked.
        TODO Should test on key not exists

        """
        x = CouchBackend(app=self.app)
        x._connection = Mock()
        mocked_get = x._connection.get = Mock()
        mocked_get.return_value = sentinel.retval
        # should return None
        self.assertEqual(x.get('1f3fab'), sentinel.retval)
        x._connection.get.assert_called_once_with('1f3fab')