reaching 80% of unit test coverage
This commit is contained in:
@@ -43,4 +43,5 @@ for attr in [name.decode() for name in httpretty.METHODS] + ['register_uri', 'en
|
||||
|
||||
|
||||
def last_request():
|
||||
"""returns the last request"""
|
||||
return httpretty.last_request
|
||||
|
||||
@@ -30,7 +30,7 @@ import sys
|
||||
import types
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
if PY3:
|
||||
if PY3: # pragma: no cover
|
||||
text_type = str
|
||||
byte_type = bytes
|
||||
import io
|
||||
@@ -40,7 +40,7 @@ if PY3:
|
||||
class BaseClass(object):
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
text_type = unicode
|
||||
byte_type = str
|
||||
import StringIO
|
||||
@@ -51,26 +51,26 @@ else:
|
||||
class BaseClass(object):
|
||||
def __repr__(self):
|
||||
ret = self.__str__()
|
||||
if PY3:
|
||||
if PY3: # pragma: no cover
|
||||
return ret
|
||||
else:
|
||||
return ret.encode('utf-8')
|
||||
|
||||
|
||||
try:
|
||||
try: # pragma: no cover
|
||||
from urllib.parse import urlsplit, urlunsplit, parse_qs, quote, quote_plus, unquote
|
||||
except ImportError:
|
||||
except ImportError: # pragma: no cover
|
||||
from urlparse import urlsplit, urlunsplit, parse_qs, unquote
|
||||
from urllib import quote, quote_plus
|
||||
|
||||
try:
|
||||
try: # pragma: no cover
|
||||
from http.server import BaseHTTPRequestHandler
|
||||
except ImportError:
|
||||
except ImportError: # pragma: no cover
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler
|
||||
|
||||
|
||||
ClassTypes = (type,)
|
||||
if not PY3:
|
||||
if not PY3: # pragma: no cover
|
||||
ClassTypes = (type, types.ClassType)
|
||||
|
||||
|
||||
|
||||
12
tests/unit/test_main.py
Normal file
12
tests/unit/test_main.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
from mock import patch
|
||||
import httpretty
|
||||
|
||||
|
||||
@patch('httpretty.httpretty')
|
||||
def test_last_request(original):
|
||||
("httpretty.last_request() should return httpretty.core.last_request")
|
||||
|
||||
httpretty.last_request().should.equal(original.last_request)
|
||||
Reference in New Issue
Block a user