def test_user_owner(self):
    mobile_user = CommCareUser.create(self.domain, 'abc', 'def', None, None)
    number = PhoneNumber(owner_doc_type='CommCareUser', owner_id=mobile_user.get_id)
    owner = number.owner
    self.assertTrue(isinstance(owner, CommCareUser))
    self.assertEqual(owner.get_id, mobile_user.get_id)
    web_user = WebUser.create(self.domain, 'ghi', 'jkl', None, None)
    number = PhoneNumber(owner_doc_type='WebUser', owner_id=web_user.get_id)
    owner = number.owner
    self.assertTrue(isinstance(owner, WebUser))
    self.assertEqual(owner.get_id, web_user.get_id)
    number = PhoneNumber(owner_doc_type='X')
    self.assertIsNone(number.owner)
def test_user_owner(self):
    mobile_user = CommCareUser.create(self.domain, 'abc', 'def', None, None)
    number = PhoneNumber(owner_doc_type='CommCareUser', owner_id=mobile_user.get_id)
    owner = number.owner
    self.assertTrue(isinstance(owner, CommCareUser))
    self.assertEqual(owner.get_id, mobile_user.get_id)
    web_user = WebUser.create(self.domain, 'ghi', 'jkl', None, None)
    number = PhoneNumber(owner_doc_type='WebUser', owner_id=web_user.get_id)
    owner = number.owner
    self.assertTrue(isinstance(owner, WebUser))
    self.assertEqual(owner.get_id, web_user.get_id)
    number = PhoneNumber(owner_doc_type='X')
    self.assertIsNone(number.owner)