ca138b1816144f6373d7be807a54b47ca3ff1111
[odoo/odoo.git] / addons / import_google / test / test_sync_google_contact_import_partner.yml
1 -
2   In order to test Importing contacts from any google account into OpenERP,
3   I use a gmail account and import the contact details and create Partners.
4 - |
5   I create a record for the gmail account for which I want to import the contacts.
6 -
7   !record {model: google.login, id: google_login_id1}:
8     user: testmail.openerp@gmail.com
9     password: openerptiny
10 - |
11   I login into that account.
12 -
13   !python {model: google.login}: |
14     self.login(cr, uid, [ref('google_login_id1')], context)
15 - |
16   Now I select from which group I want to get the contact details and I want to create partner for all contacts.
17 -
18   !record {model: synchronize.google.import, id: synchronize_google_import_id1}:
19     create_partner: create_all
20     group_name: all
21 - |
22   I import the contacts.
23 -
24   !python {model: synchronize.google.import}: |
25     self.import_google(cr, uid, [ref('synchronize_google_import_id1')], context={'contact':True})
26 - |
27   I check whether the Partners are created or not.
28 -
29   !python {model: res.partner }: |
30     addr_obj = self.pool.get('ir.model.data')
31     addr_ids = addr_obj.search(cr, uid, [])
32     data_ids = addr_obj.search(cr, uid, [('model','=','res.partner'),('module','=','synchronize_google')])
33     address_ids = map(lambda x: x.res_id, [child for child in addr_obj.browse(cr, uid, data_ids) if child.res_id])
34     partner_ids = map(lambda x: x.parent_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.parent_id])
35     assert partner_ids, 'Partners not created !'
36