Permalink
Browse files

fixes from feedback

  • Loading branch information...
Jeff Hammel
Jeff Hammel committed Aug 1, 2012
1 parent 1aedd43 commit 5d35570f7469b208f1b6a11674f8687d11e0e223
Showing with 19 additions and 6 deletions.
  1. +5 −5 dzclient/client.py
  2. +14 −1 dzclient/tests/test_datazilla_request.py
View
@@ -43,7 +43,7 @@ def join_results(self, results):
suite.setdefault(test_name, []).extend(values)
class DatazillaResultsCollection(object):
-
+ """DatazillaResultsCollection manages test information and serialization to JSON"""
def __init__(self, machine_name="", os="", os_version="", platform="",
build_name="", version="", revision="", branch="", id="",
@@ -104,7 +104,7 @@ def datasets(self):
class DatazillaRequest(DatazillaResultsCollection):
"""
- Datazilla request object that manages test information and submission.
+ Datazilla request object that manages test submission.
Note that the revision id can be 16 characters, maximum.
@@ -115,15 +115,15 @@ def create(cls, host, project, oauth_key, oauth_secret, collection):
"""create a DatazillaRequest instance from a results collection"""
# get attributes from the collection
- attributes = inspect.getargspec(foo).args[1:]
- kw = dict([(i, gettattr(collection, i))
+ attributes = inspect.getargspec(DatazillaResultsCollection.__init__).args[1:]
+ kw = dict([(i, getattr(collection, i))
for i in attributes])
# create the instance
instance = cls(host, project, oauth_key, oauth_secret, **kw)
# add the results
- instance.add_datazilla_results(collection.results)
+ instance.add_datazilla_result(collection.results)
return instance
@@ -1,6 +1,6 @@
import unittest
from mock import patch
-from dzclient import DatazillaRequest, DatazillaResult
+from dzclient import DatazillaRequest, DatazillaResult, DatazillaResultsCollection
class DatazillaRequestTest(unittest.TestCase):
@@ -36,6 +36,19 @@ def test_add_second_datazilla_result(self):
{'suite1': {'test': [1]}, 'suite2': {'test': [2]}},
)
+ def test_create_from_results_collection(self):
+ collection = DatazillaResultsCollection(machine_name='localhost',
+ os='linux')
+ test_date = collection.test_date
+ req = DatazillaRequest.create('host', 'project', 'key', 'secret', collection)
+ self.assertEqual(req.machine_name, 'localhost')
+ self.assertEqual(req.os, 'linux')
+ self.assertEqual(req.test_date, test_date)
+ self.assertEqual(req.host, 'host')
+ self.assertEqual(req.project, 'project')
+ self.assertEqual(req.oauth_key, 'key')
+ self.assertEqual(req.oauth_secret, 'secret')
+
def test_datasets(self):
"""Tests dataset creation for submission to datazilla"""

0 comments on commit 5d35570

Please sign in to comment.