def test_kwargs_from_temba(self): temba_contact_field = TembaContactField.create(key='foo', label='Bar', value_type='T') kwargs = ContactField.kwargs_from_temba(self.nigeria, temba_contact_field) self.assertEqual(kwargs, dict(org=self.nigeria, key='foo', label='Bar', value_type='T')) # try creating contact from them ContactField.objects.create(**kwargs)
def test_update_or_create_from_temba(self): temba_contact_field = TembaContactField.create(key='foo', label='Bar', value_type='T') field = ContactField.update_or_create_from_temba(self.nigeria, temba_contact_field) self.assertEqual(field.key, 'foo') self.assertEqual(field.label, 'Bar') updated_field = ContactField.update_or_create_from_temba(self.nigeria, temba_contact_field) self.assertEqual(field.pk, updated_field.pk)
def test_kwargs_from_temba(self): temba_contact_field = TembaContactField.create(key='foo', label='Bar', value_type='T') kwargs = ContactField.kwargs_from_temba(self.nigeria, temba_contact_field) self.assertEqual( kwargs, dict(org=self.nigeria, key='foo', label='Bar', value_type='T')) # try creating contact from them ContactField.objects.create(**kwargs)
def test_update_or_create_from_temba(self): temba_contact_field = TembaContactField.create(key='foo', label='Bar', value_type='T') field = ContactField.update_or_create_from_temba( self.nigeria, temba_contact_field) self.assertEqual(field.key, 'foo') self.assertEqual(field.label, 'Bar') updated_field = ContactField.update_or_create_from_temba( self.nigeria, temba_contact_field) self.assertEqual(field.pk, updated_field.pk)