def test_by_domain(self):
    number1 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999123', verified=True, pending_verification=False, is_two_way=True)
    number2 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999124', verified=False, pending_verification=False, is_two_way=False)
    number3 = PhoneNumber.objects.create(domain=(self.domain + 'X'), owner_doc_type='X', owner_id='X', phone_number='999124', verified=True, pending_verification=False, is_two_way=True)
    self.addCleanup(number3.delete)
    self.assertEqual(set(PhoneNumber.by_domain(self.domain)), set([number1, number2]))
    self.assertEqual(set(PhoneNumber.by_domain(self.domain, ids_only=True)), set([number1.couch_id, number2.couch_id]))
    self.assertEqual(PhoneNumber.count_by_domain(self.domain), 2)
def test_by_domain(self):
    number1 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999123', verified=True, pending_verification=False, is_two_way=True)
    number2 = PhoneNumber.objects.create(domain=self.domain, owner_doc_type='X', owner_id='X', phone_number='999124', verified=False, pending_verification=False, is_two_way=False)
    number3 = PhoneNumber.objects.create(domain=(self.domain + 'X'), owner_doc_type='X', owner_id='X', phone_number='999124', verified=True, pending_verification=False, is_two_way=True)
    self.addCleanup(number3.delete)
    self.assertEqual(set(PhoneNumber.by_domain(self.domain)), set([number1, number2]))
    self.assertEqual(set(PhoneNumber.by_domain(self.domain, ids_only=True)), set([number1.couch_id, number2.couch_id]))
    self.assertEqual(PhoneNumber.count_by_domain(self.domain), 2)