Closed Bug 948415 Opened 11 years ago Closed 10 years ago

Make mock_contact.py pythonic, make insert_contact convert it to API-friendly format

Categories

(Firefox OS Graveyard :: Gaia::UI Tests, defect, P4)

Other
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zcampbell, Assigned: gentlefolk)

Details

(Whiteboard: [gaia-ui-test][mentor=davehunt][lang=py])

Attachments

(1 file, 3 obsolete files)

Some while back the mock_contact.py was changed to contain lists rather than nice Python-ness.

This task is to
1. Revert mock_contact.py back to Python [1]
2. Add to mock_contact.py a method to output to mozContact API friendly format [2]
3. In GaiaData.insert_contact , convert the contact to mozContact API friendly format before passing it into the javascript atom
4. Update all functional and endurance tests to use the revised mock_contact.py

Resources:
[1] https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaia-ui-tests/gaiatest/mocks/mock_contact.py
[2] https://wiki.mozilla.org/WebAPI/ContactsAPI
I'd be willing to take this on if possible.
You're welcome Craig. I've assigned you. This is a fairly intermediate level task I'd say, taking into account you have to learn Firefox OS's idiosyncrasies too. Let me know if you would prefer a simpler task or if it's OK.

Keep in touch with us so we know how progress is going and whether we can help you! 

For any help you can email us directly or better to pop into #mozwebqa and #gaia channels on the IRC list.
Assignee: nobody → cemacken
Great thanks!
Attachment #8365584 - Flags: review?(dave.hunt)
Comment on attachment 8365584 [details] [review]
Initial pull request for changes to MockContact

Thanks for the patch, Craig! At the moment I feel like it's either over-complicated or under-documented. Could you add more comments to your code to explain what's happening, and please also add a unit test.
Attachment #8365584 - Flags: review?(dave.hunt) → review-
Fair enough. I'll simplify/document and add a proper unit test.
Attachment #8365584 - Attachment is obsolete: true
Attachment #8367058 - Flags: review?(dave.hunt)
Comment on attachment 8367058 [details] [review]
Simplified creation of mozcontact api contact, added unit test

Thanks Craig, that looks great! I'm going to request an additional review from Zac, but this gets my r+
Attachment #8367058 - Flags: review?(zcampbell)
Attachment #8367058 - Flags: review?(dave.hunt)
Attachment #8367058 - Flags: review+
Oh, and the commits will need to be squashed before we can merge. You can either take care of this yourself, or we can do it before we merge. The commit message should be in the form of:

Bug [id] - [summary] r=[reviewer r=reviewer...]

So for this bug it might be:

Bug 948415 - Make mock_contact.py pythonic, make insert_contact convert it to API-friendly format. r=dhunt r=zcampbell
Whoa this looked to be a bit more work than I expected but it looks great! Thanks for your patience and hard work on this Craig, working out the API stuff. I'm reviewing/running the tests now
Comment on attachment 8367058 [details] [review]
Simplified creation of mozcontact api contact, added unit test

Some tests are missing migration in cases where we re-use attributes of the contact in the test. They are:

contacts/test_add_photo_to_contact.py
contacts/test_call_contact.py
contacts/test_sms_contact.py
dialer/test_dialer_find_contact.py
dialer/test_dialer_add_contact.py

Functionally it is working excellently :)
Attachment #8367058 - Flags: review?(zcampbell) → review-
Attachment #8367058 - Attachment is obsolete: true
Attachment #8367767 - Flags: review?(zcampbell)
re Comment 9, I'll squash things once I've gotten review+'d by Zac. If you want to merge it in before I get to around to it, feel free to do it yourselves.
Thanks for the very through comment response, way more than was required!
Code looks good, just doing a test run and grep to check that all tests are migrated.

Then I can give you the all clear to squash.
Comment on attachment 8367767 [details] [review]
Migrated tests that were not converted to the new MockContact interface

r-, One syntax error in test_add_photo_to_contact.py
Attachment #8367767 - Flags: review?(zcampbell) → review-
Attachment #8367767 - Attachment is obsolete: true
Attachment #8368322 - Flags: review?(zcampbell)
Comment on attachment 8368322 [details] [review]
Fixed syntax error, migrated test to new MockContact interface

r+!
Let's squash then merge!
Attachment #8368322 - Flags: review?(zcampbell) → review+
Commits have now been squashed.
Attachment #8368322 - Flags: review?(florin.strugariu)
Attachment #8368322 - Flags: review?(florin.strugariu) → review+
Merged in https://github.com/mozilla-b2g/gaia/commit/15e4d356077a71bd2c9c3678e9d3bc4d136a58ee

Thanks for the hard work :gentlefolk
Status: NEW → RESOLVED
Closed: 10 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: