Beispiel #1
0
 def test_no_contact_info(self):
     """Do things work properly when we lack contact information?"""
     self.atty['contact'] = ""
     a = add_attorney(self.atty, self.p, self.d)
     # No org info added because none provided:
     self.assertEqual(a.organizations.all().count(), 0)
     # But roles still get done.
     self.assertEqual(a.roles.all().count(), 2)
Beispiel #2
0
 def test_no_contact_info(self):
     """Do things work properly when we lack contact information?"""
     self.atty['contact'] = ""
     a = add_attorney(self.atty, self.p, self.d)
     # No org info added because none provided:
     self.assertEqual(a.organizations.all().count(), 0)
     # But roles still get done.
     self.assertEqual(a.roles.all().count(), 2)
Beispiel #3
0
 def test_no_contact_info_another_already_exists(self):
     """If we lack contact info, and such a atty already exists (without
     contact info), do we properly consider them different people?
     """
     new_a = Attorney.objects.create(name=self.atty_name)
     self.atty['contact'] = ''
     a_pk = add_attorney(self.atty, self.p, self.d)
     a = Attorney.objects.get(pk=a_pk)
     self.assertNotEqual(a.pk, new_a.pk)
Beispiel #4
0
 def test_no_contact_info_another_already_exists(self):
     """If we lack contact info, and such a atty already exists (without
     contact info), do we properly consider them the same person?
     """
     new_a = Attorney.objects.create(name=self.atty_name,
                                     date_sourced=date(2016, 12, 31))
     self.atty['contact'] = ''
     a = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a.pk, new_a.pk)
Beispiel #5
0
 def test_no_contact_info_another_already_exists(self):
     """If we lack contact info, and such a atty already exists (without 
     contact info), do we properly consider them the same person?
     """
     new_a = Attorney.objects.create(name=self.atty_name,
                                     date_sourced=date(2016, 12, 31))
     self.atty['contact'] = ''
     a = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a.pk, new_a.pk)
Beispiel #6
0
 def test_docket_is_older(self):
     """If the atty already exists, but with newer data than the docket, do
     we avoid updating the better data?
     """
     a_orig = Attorney.objects.create(name=self.atty_name,
                                      email=self.atty_email,
                                      date_sourced=date(2017, 1, 2))
     a_from_docket = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a_orig.pk, a_from_docket.pk)
     # No updates?
     self.assertEqual(a_orig.phone, a_from_docket.phone)
     self.assertEqual(a_from_docket.roles.all().count(), 2)
Beispiel #7
0
 def test_docket_is_newer(self):
     """If the atty already exists, but with older data than the docket, do
     we update the old data?
     """
     a_orig = Attorney.objects.create(name=self.atty_name,
                                      email=self.atty_email,
                                      date_sourced=date(2016, 12, 31))
     a_from_docket = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a_orig.pk, a_from_docket.pk)
     # Phone updated? (Adding newly sourced docket should update old info)
     self.assertNotEqual(a_orig.phone, a_from_docket.phone)
     self.assertEqual(a_from_docket.roles.all().count(), 2)
Beispiel #8
0
 def test_existing_roles_get_overwritten(self):
     """Do existing roles get overwritten with latest data?"""
     new_a = Attorney.objects.create(name=self.atty_name,
                                     email=self.atty_email,
                                     date_sourced=date(2017, 1, 2))
     r = Role.objects.create(attorney=new_a, party=self.p, docket=self.d,
                             role=Role.DISBARRED)
     a = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(new_a.pk, a.pk)
     roles = a.roles.all()
     self.assertEqual(roles.count(), 2)
     self.assertNotIn(r, roles)
Beispiel #9
0
 def test_docket_is_older(self):
     """If the atty already exists, but with newer data than the docket, do 
     we avoid updating the better data?
     """
     a_orig = Attorney.objects.create(name=self.atty_name,
                                      email=self.atty_email,
                                      date_sourced=date(2017, 1, 2))
     a_from_docket = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a_orig.pk, a_from_docket.pk)
     # No updates?
     self.assertEqual(a_orig.phone, a_from_docket.phone)
     self.assertEqual(a_from_docket.roles.all().count(), 2)
Beispiel #10
0
 def test_docket_is_newer(self):
     """If the atty already exists, but with older data than the docket, do 
     we update the old data?
     """
     a_orig = Attorney.objects.create(name=self.atty_name,
                                      email=self.atty_email,
                                      date_sourced=date(2016, 12, 31))
     a_from_docket = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a_orig.pk, a_from_docket.pk)
     # Phone updated? (Adding newly sourced docket should update old info)
     self.assertNotEqual(a_orig.phone, a_from_docket.phone)
     self.assertEqual(a_from_docket.roles.all().count(), 2)
Beispiel #11
0
 def test_new_atty_to_db(self):
     """Can we add a new atty to the DB when none exist?"""
     a = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a.contact_raw, self.atty['contact'])
     self.assertEqual(a.name, self.atty['name'])
     self.assertTrue(
         AttorneyOrganizationAssociation.objects.filter(
             attorney=a,
             attorney_organization__name=self.atty_org_name,
             docket=self.d,
         ).exists(),
         msg="Unable to find attorney organization association.")
     self.assertEqual(a.email, self.atty_email)
     self.assertEqual(a.roles.all().count(), 2)
Beispiel #12
0
 def test_new_atty_to_db(self):
     """Can we add a new atty to the DB when none exist?"""
     a = add_attorney(self.atty, self.p, self.d)
     self.assertEqual(a.contact_raw, self.atty['contact'])
     self.assertEqual(a.name, self.atty['name'])
     self.assertTrue(
         AttorneyOrganizationAssociation.objects.filter(
             attorney=a,
             attorney_organization__name=self.atty_org_name,
             docket=self.d,
         ).exists(),
         msg="Unable to find attorney organization association."
     )
     self.assertEqual(a.email, self.atty_email)
     self.assertEqual(a.roles.all().count(), 2)