diff options
Diffstat (limited to 'addons/import_google/test')
3 files changed, 106 insertions, 0 deletions
diff --git a/addons/import_google/test/test_sync_google_calendar.yml b/addons/import_google/test/test_sync_google_calendar.yml new file mode 100644 index 00000000000..28863f358bb --- /dev/null +++ b/addons/import_google/test/test_sync_google_calendar.yml @@ -0,0 +1,36 @@ +- + In order to test google calendar feature with OpenERP, I import events from + a google account and store them in Meetings. +- | + I create a record for the gmail account for which I want to import the contacts. +- + !record {model: google.login, id: google_login_id0}: + user: testmail.openerp@gmail.com + password: openerptiny +- | + I login into that account. +- + !python {model: google.login}: | + self.login(cr, uid, [ref('google_login_id0')], context) +- | + Now I want to import all the events from all the calendars in the user account. +- | + I select all calendars. +- + !record {model: synchronize.google.import, id: synchronize_google_import_id0}: + calendar_name: all +- | + I import the events from the google calendar. +- + !python {model: synchronize.google.import}: | + self.import_google(cr, uid, [ref('synchronize_google_import_id0')], context={'calendar':True}) +- | + Now I check my meetings are created or not. +- + !python {model: crm.meeting}: | + model_obj = self.pool.get('ir.model.data') + meeting_ids = self.search(cr, uid, []) + model_ids = model_obj.search(cr, uid, [('res_id','in',meeting_ids),('model','=','crm.meeting'),('module','=','synchronize_google')]) + assert model_ids, 'Meetings not created !' + + diff --git a/addons/import_google/test/test_sync_google_contact_import_address.yml b/addons/import_google/test/test_sync_google_contact_import_address.yml new file mode 100644 index 00000000000..b1a8f9a2e09 --- /dev/null +++ b/addons/import_google/test/test_sync_google_contact_import_address.yml @@ -0,0 +1,34 @@ +- + In order to test Importing contacts from any google account into OpenERP, + I use a gmail account and import the contact details and store them as Partner addresses. +- | + I create a record for the gmail account for which I want to import the contacts. +- + !record {model: google.login, id: google_login_id0}: + user: testmail.openerp@gmail.com + password: openerptiny +- | + I login into that account. +- + !python {model: google.login}: | + self.login(cr, uid, [ref('google_login_id0')], context) +- | + Now I select from which group I want to get the contact details. +- + !record {model: synchronize.google.import, id: synchronize_google_import_id0}: + create_partner: create_address + group_name: all + calendar_name: all +- | + I import the contacts and I also check if the contact already exists in db and updates the address. +- + !python {model: synchronize.google.import}: | + self.import_google(cr, uid, [ref('synchronize_google_import_id0')], context={'contact':True}) +- | + I check whether the Contacts are created in Partner address or not. +- + !python {model: res.partner.address}: | + addr_obj = self.pool.get('ir.model.data') + data_ids = addr_obj.search(cr, uid, [('model','=','res.partner.address'),('module','=','synchronize_google')]) + assert data_ids, 'Addresses not created !' +
\ No newline at end of file diff --git a/addons/import_google/test/test_sync_google_contact_import_partner.yml b/addons/import_google/test/test_sync_google_contact_import_partner.yml new file mode 100644 index 00000000000..4eadbf0f100 --- /dev/null +++ b/addons/import_google/test/test_sync_google_contact_import_partner.yml @@ -0,0 +1,36 @@ +- + In order to test Importing contacts from any google account into OpenERP, + I use a gmail account and import the contact details and create Partners. +- | + I create a record for the gmail account for which I want to import the contacts. +- + !record {model: google.login, id: google_login_id1}: + user: testmail.openerp@gmail.com + password: openerptiny +- | + I login into that account. +- + !python {model: google.login}: | + self.login(cr, uid, [ref('google_login_id1')], context) +- | + Now I select from which group I want to get the contact details and I want to create partner for all contacts. +- + !record {model: synchronize.google.import, id: synchronize_google_import_id1}: + create_partner: create_all + group_name: all +- | + I import the contacts. +- + !python {model: synchronize.google.import}: | + self.import_google(cr, uid, [ref('synchronize_google_import_id1')], context={'contact':True}) +- | + I check whether the Partners are created or not. +- + !python {model: res.partner.address }: | + addr_obj = self.pool.get('ir.model.data') + addr_ids = addr_obj.search(cr, uid, []) + data_ids = addr_obj.search(cr, uid, [('model','=','res.partner.address'),('module','=','synchronize_google')]) + address_ids = map(lambda x: x.res_id, [child for child in addr_obj.browse(cr, uid, data_ids) if child.res_id]) + partner_ids = map(lambda x: x.partner_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.partner_id]) + assert partner_ids, 'Partners not created !' +
\ No newline at end of file |
