summaryrefslogtreecommitdiff
path: root/test_requests.py
diff options
context:
space:
mode:
authorKamil Madac <kamil.madac@gmail.com>2013-12-04 15:10:24 +0100
committerKamil Madac <kamil.madac@gmail.com>2013-12-04 15:10:24 +0100
commit0d52ef7084a6839376be182dd91e9e003d3275ff (patch)
tree69ed2a8c87ccf137bfd4a32e9a3ecef6499fae2d /test_requests.py
parent947248129ba3b0917c86c013f24d7499c15cb8ae (diff)
downloadpython-requests-0d52ef7084a6839376be182dd91e9e003d3275ff.tar.gz
Additional tests added
Diffstat (limited to 'test_requests.py')
-rwxr-xr-xtest_requests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test_requests.py b/test_requests.py
index 8e6a1647..251d2ea0 100755
--- a/test_requests.py
+++ b/test_requests.py
@@ -939,5 +939,17 @@ class UtilsTestCase(unittest.TestCase):
assert not is_ipv4_network('8.8.8.8')
assert is_ipv4_network('192.168.1.0/24')
+ def test_dotted_netmask(self):
+ from requests.utils import dotted_netmask
+ assert dotted_netmask(8) == '255.0.0.0'
+ assert dotted_netmask(24) == '255.255.255.0'
+ assert dotted_netmask(25) == '255.255.255.128'
+
+ def test_address_in_network(self):
+ from requests.utils import address_in_network
+ assert address_in_network('192.168.1.1', '192.168.1.0/24')
+ assert not address_in_network('172.16.0.1', '192.168.1.0/24')
+
+
if __name__ == '__main__':
unittest.main()