-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://proj.badc.rl.ac.uk/svn/ndg-security/trunk/ndg_httpsclient@7989 051b1e3e-aa0c-0410-b6c2-bfbade6052be
- Loading branch information
pjkersha
committed
Jan 17, 2012
1 parent
8018eaf
commit e53ddbc
Showing
16 changed files
with
179 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Makefile to generate epydoc documentation for the NDG HTTPS Client Package | ||
# | ||
# @author P J Kershaw 17/01/12 | ||
# | ||
|
||
# @copyright: (C) 2012 STFC | ||
# | ||
# @license: BSD - see LICENSE file for details | ||
# | ||
# $Id$ | ||
|
||
# Generate HTML from embedded epydoc text in source code. | ||
EPYDOC=epydoc | ||
EPYDOC_INDIR=../ndg | ||
EPYDOC_OUTDIR=. | ||
EPYDOC_NAME='NDG HTTPS Client' | ||
EPYDOC_LOGFILE=epydoc.log | ||
EPYDOC_OPTS=--no-frames --include-log --graph=all -v --debug | ||
ZIP=zip | ||
ZIP_OUTFILE=./documentation.zip | ||
ZIP_INFILES=./*.* | ||
|
||
epydoc: | ||
${EPYDOC} ${EPYDOC_INDIR} -o ${EPYDOC_OUTDIR} --name ${EPYDOC_NAME} \ | ||
${EPYDOC_OPTS} > ${EPYDOC_LOGFILE} | ||
|
||
zip: | ||
${ZIP} ${ZIP_OUTFILE} ${ZIP_INFILES} | ||
|
||
clean: | ||
rm -f *.txt *.html *.gif *.css *.js *.png *.log |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
NDG HTTPS Client Unit tests directory | ||
===================================== | ||
The unit tests expect to connect to a simple HTTPS server listening on port | ||
4443. An OpenSSL script is provided for this purpose in scripts/. To run, | ||
|
||
$ ./scripts/openssl_https_server.sh | ||
|
||
Troubleshooting | ||
--------------- | ||
Run it from *this* directory. Also ensure it is has execute bits set. e.g. | ||
|
||
$ chmod 755 ./scripts/openssl_https_server.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,51 @@ | ||
''' | ||
Created on Jan 6, 2012 | ||
"""unit tests module for ndg.httpsclient.utils module | ||
@author: philipkershaw | ||
''' | ||
PyOpenSSL utility to make a httplib-like interface suitable for use with | ||
urllib2 | ||
""" | ||
__author__ = "P J Kershaw (STFC)" | ||
__date__ = "06/01/12" | ||
__copyright__ = "(C) 2012 Science and Technology Facilities Council" | ||
__license__ = "BSD - see LICENSE file in top-level directory" | ||
__contact__ = "Philip.Kershaw@stfc.ac.uk" | ||
__revision__ = '$Id$' | ||
import unittest | ||
import os | ||
|
||
from OpenSSL import SSL | ||
|
||
class TestGetModule(unittest.TestCase): | ||
from ndg.httpsclient.test import Constants | ||
from ndg.httpsclient.utils import (Configuration, fetch_from_url, open_url, | ||
_should_use_proxy) | ||
|
||
|
||
def test01(self): | ||
pass | ||
class TestUtilsModule(unittest.TestCase): | ||
'''Test ndg.httpsclient.utils module''' | ||
|
||
def test01_configuration(self): | ||
config = Configuration(SSL.Context(SSL.SSLv3_METHOD), True) | ||
self.assert_(config.ssl_context) | ||
self.assertEquals(config.debug, True) | ||
|
||
def test02_fetch_from_url(self): | ||
config = Configuration(SSL.Context(SSL.SSLv3_METHOD), True) | ||
res = fetch_from_url(Constants.TEST_URI, config) | ||
self.assert_(res) | ||
|
||
def test03_open_url(self): | ||
config = Configuration(SSL.Context(SSL.SSLv3_METHOD), True) | ||
res = open_url(Constants.TEST_URI, config) | ||
self.assertEqual(res[0], 200, | ||
'open_url for %r failed' % Constants.TEST_URI) | ||
|
||
def test04__should_use_proxy(self): | ||
self.assertTrue(_should_use_proxy(Constants.TEST_URI), | ||
'Expecting use proxy = True') | ||
|
||
os.environ['no_proxy'] = 'localhost,localhost.localdomain' | ||
self.assertFalse(_should_use_proxy(Constants.TEST_URI), | ||
'Expecting use proxy = False') | ||
del os.environ['no_proxy'] | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.