Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

https://github.com/mozilla/datazilla_client/issues/19 #20

Merged
merged 1 commit into from

2 participants

@k0s
k0s commented

No description provided.

@malini malini merged commit 1a4d0d2 into mozilla:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 7, 2012
  1. @k0s

    mozilla#19

    k0s authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 11 deletions.
  1. +6 −7 dzclient/client.py
  2. +4 −4 dzclient/tests/test_datazilla_request.py
View
13 dzclient/client.py
@@ -144,6 +144,8 @@ class DatazillaRequest(DatazillaResultsCollection):
"""
+ protocols = set(['http', 'https']) # supported protocols
+
@classmethod
def create(cls, protocol, host, project, oauth_key,
oauth_secret, collection):
@@ -175,13 +177,10 @@ def __init__(self, protocol, host, project, oauth_key, oauth_secret, **kw):
self.oauth_key = oauth_key
self.oauth_secret = oauth_secret
- self.protocols = set(['http', 'https'])
-
- if protocol in self.protocols:
- self.protocol = protocol
- else:
- #Default to https
- self.protocol = 'https'
+ if protocol not in self.protocols:
+ raise AssertionError("Protocol '%s' not supported; please use one of %s" %
+ (protocol, ', '.join(self.protocols)))
+ self.protocol = protocol
DatazillaResultsCollection.__init__(self, **kw)
View
8 dzclient/tests/test_datazilla_request.py
@@ -7,7 +7,7 @@ class DatazillaRequestTest(unittest.TestCase):
def test_init_with_date(self):
"""Can provide test date on instantiation."""
req = DatazillaRequest(
- 'protocol', 'host', 'project', 'key', 'secret', test_date=12345)
+ 'http', 'host', 'project', 'key', 'secret', test_date=12345)
self.assertEqual(req.test_date, 12345)
@@ -15,7 +15,7 @@ def test_init_with_date(self):
def test_add_datazilla_result(self):
"""Can add a DatazillaResult to a DatazillaRequest."""
req = DatazillaRequest(
- 'protocol', 'host', 'project', 'key', 'secret'
+ 'http', 'host', 'project', 'key', 'secret'
)
res = DatazillaResult({'suite': {'test': [1, 2, 3]}})
@@ -27,7 +27,7 @@ def test_add_datazilla_result(self):
def test_add_second_datazilla_result(self):
"""Adding a second DatazillaResult joins their results."""
req = DatazillaRequest(
- 'protocol', 'host', 'project', 'key', 'secret'
+ 'http', 'host', 'project', 'key', 'secret'
)
res1 = DatazillaResult({'suite1': {'test': [1]}})
res2 = DatazillaResult({'suite2': {'test': [2]}})
@@ -45,7 +45,7 @@ def test_create_from_results_collection(self):
os='linux')
test_date = collection.test_date
req = DatazillaRequest.create(
- 'protocol', 'host', 'project', 'key', 'secret', collection
+ 'http', 'host', 'project', 'key', 'secret', collection
)
self.assertEqual(req.machine_name, 'localhost')
self.assertEqual(req.os, 'linux')
Something went wrong with that request. Please try again.