def testGetOrCreate(self):
    before = self.mobile_worker1.get_or_create_phone_entry('999123')
    self.assertEqual(before.owner_doc_type, 'CommCareUser')
    self.assertEqual(before.owner_id, self.mobile_worker1.get_id)
    self.assertEqual(before.phone_number, '999123')
    self.assertEqual(PhoneNumber.by_domain(self.domain).count(), 1)
    after = self.mobile_worker1.get_or_create_phone_entry('999123')
    self.assertEqual(before.pk, after.pk)
    self.assertEqual(after.owner_doc_type, 'CommCareUser')
    self.assertEqual(after.owner_id, self.mobile_worker1.get_id)
    self.assertEqual(after.phone_number, '999123')
    self.assertEqual(PhoneNumber.by_domain(self.domain).count(), 1)
def testGetOrCreate(self):
    before = self.mobile_worker1.get_or_create_phone_entry('999123')
    self.assertEqual(before.owner_doc_type, 'CommCareUser')
    self.assertEqual(before.owner_id, self.mobile_worker1.get_id)
    self.assertEqual(before.phone_number, '999123')
    self.assertEqual(PhoneNumber.by_domain(self.domain).count(), 1)
    after = self.mobile_worker1.get_or_create_phone_entry('999123')
    self.assertEqual(before.pk, after.pk)
    self.assertEqual(after.owner_doc_type, 'CommCareUser')
    self.assertEqual(after.owner_id, self.mobile_worker1.get_id)
    self.assertEqual(after.phone_number, '999123')
    self.assertEqual(PhoneNumber.by_domain(self.domain).count(), 1)