Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

We shouldn't need a settings file for regular use. Switch to passing …

…in credentials.
  • Loading branch information...
commit 777496b00577a649fba61e6494b7129403f0a2f1 1 parent a6ad2ae
@clouserw authored
View
8 README.rst
@@ -20,12 +20,11 @@ Manager through a maze of clicking:
Basic Use
---------
-Just copy settings.py-dist to settings.py and fill in appropriate values. Once
-setup, import into your project. A simple example::
+A simple example::
>>> from hera import Hera
- >>> h = Hera()
+ >>> h = Hera(username, password, location)
# Empties the entire cache
>>> h.flushAll()
@@ -34,7 +33,8 @@ setup, import into your project. A simple example::
Tests
-----
-After configuring the ``settings.py`` file, simply run ``fab test``.
+Copy ``test_settings.py-dist`` to ``test_settings.py`` and fill in all the
+values. Then run ``fab test``.
.. _Zeus Traffic Manager: http://www.zeus.com/
View
17 hera.py
@@ -5,16 +5,9 @@
from suds.transport.http import HttpAuthenticated
from suds.xsd.doctor import ImportDoctor, Import
-import settings
-
-if settings.LOG_LEVEL:
- import logging
- logging.basicConfig(level=settings.LOG_LEVEL)
-
-
class Hera:
- def __init__(self, wsdl="System.Cache.wsdl"):
+ def __init__(self, username, password, location, wsdl="System.Cache.wsdl"):
# Sorry windows
url = "file://%s" % os.path.abspath(os.path.join('wsdl', wsdl))
@@ -29,12 +22,10 @@ def __init__(self, wsdl="System.Cache.wsdl"):
imp.filter.add('http://soap.zeus.com/zxtm/1.1/')
doctor = ImportDoctor(imp)
- transporter = HttpAuthenticated(username=settings.USERNAME,
- password=settings.PASSWORD)
+ transporter = HttpAuthenticated(username=username, password=password)
- self.client = Client(url, doctor=doctor,
- location=settings.LOCATION,
- transport=transporter)
+ self.client = Client(url, doctor=doctor, location=location,
+ transport=transporter)
def flushAll(self):
"""Flushes everything in the system: all objects across all virtual
View
12 settings.py-dist
@@ -1,12 +0,0 @@
-# https://fedorahosted.org/suds/wiki/Documentation#LOGGING
-import logging
-LOG_LEVEL = None
-
-LOCATION = 'https://zeus:9090/soap'
-USERNAME = ''
-PASSWORD = ''
-
-# If you want to run the tests, you'll need to add at least 2 complete URLs
-# here that are behind your Zeus box. We'll load/flush them to make sure
-# things are working.
-TEST_URLS = []
View
8 test_settings.py-dist
@@ -0,0 +1,8 @@
+# You only need to fill this file out if you want to run the tests.
+
+USERNAME = ''
+PASSWORD = ''
+LOCATION = 'https://zeus:9090/soap'
+
+# We need at least two complete URLs that can be loaded/expired from the tests
+TEST_URLS = []
View
5 tests/test_hera.py
@@ -2,7 +2,7 @@
import urllib
from urlparse import urlparse
-import settings
+import test_settings as settings
from hera.hera import Hera
@@ -11,7 +11,8 @@ class TestInterface(unittest.TestCase):
def setUp(self):
if len(settings.TEST_URLS) < 2:
self.fail("Please add at least 2 URLs we can test.")
- self.hera = Hera()
+ self.hera = Hera(settings.USERNAME, settings.PASSWORD,
+ settings.LOCATION)
def _loadTestURLs(self):
for url in settings.TEST_URLS:
Please sign in to comment.
Something went wrong with that request. Please try again.