Closed Bug 885145 Opened 13 years ago Closed 13 years ago

Add tests for mozinfo

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ffledgling, Assigned: ffledgling)

Details

Attachments

(1 file)

additional tests are required for mozinfo
Assignee: nobody → ffledgling
Status: NEW → ASSIGNED
Patch adds tests to test handling of invalid json by the update* methods, and removes the removes redundant imports.
Attachment #765118 - Flags: review?(jhammel)
Attachment #765118 - Flags: review?(jhammel) → review?(ahalberstadt)
Comment on attachment 765118 [details] [diff] [review] Adds tests for to test handling of invalid json by update* methods Review of attachment 765118 [details] [diff] [review]: ----------------------------------------------------------------- ::: mozinfo/tests/test.py @@ +61,5 @@ > + handle invalid JSON""" > + j = os.path.join(self.tempdir, "mozinfo.json") > + with open(j, 'w') as f: > + f.write('invalid{"json":') > + self.assertRaises(ValueError, mozinfo.find_and_update_from_json, self.tempdir) I don't know that this is terribly useful as the ValueError is going to get raised in "update()" anyway which we're already testing. Maybe instead we could use mock to assert that find_and_update_from_json calls update exactly once (like second example in http://www.voidspace.org.uk/python/mock/getting-started.html#mock-patching-methods). That being said, it isn't really hurting anything either so if you want to leave it as is that's fine by me.
Attachment #765118 - Flags: review?(ahalberstadt) → review+
It might be a decent idea to consult https://bugzilla.mozilla.org/show_bug.cgi?id=881417
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: