예제 #1
0
    def test_contact_verification_failed(self):
        WHOIS.get_contact_status_descriptions.return_value = self._get_contact_status()
        WHOIS.get_contact_by_handle.return_value = self._get_contact(
            statuses=[STATUS_LINKED, STATUS_VERIFICATION_FAILED],
        )
        WHOIS.get_registrar_by_handle.return_value = self._get_registrar()
        response = self.client.get(reverse("webwhois:detail_contact", kwargs={"handle": "mycontact"}))

        self.assertContains(response, "Contact details")
        verification_status = response.context["registry_objects"]['contact']['verification_status']
        self.assertEqual(verification_status[0]['code'], STATUS_VERIFICATION_FAILED)
        self.assertEqual(verification_status[0]['icon'], 'webwhois/img/icon-red-cross.gif')
        self.assertEqual(self.LOGGER.mock_calls, [
            CALL_BOOL,
            call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
                ('handle', 'mycontact'), ('handleType', 'contact'))),
            call.create_request().close(properties=[('foundType', 'contact')])
        ])
        self.assertEqual(self.LOGGER.create_request().result, 'Ok')
        self.assertEqual(WHOIS.mock_calls, [
            call.get_contact_by_handle('mycontact'),
            call.get_contact_status_descriptions('en'),
            call.get_registrar_by_handle('REG-FRED_A'),
            call.get_registrar_by_handle('REG-FRED_A')
        ])
예제 #2
0
 def test_contact_with_ssn_type_birthday(self):
     WHOIS.get_contact_status_descriptions.return_value = self._get_contact_status()
     ident = DisclosableContactIdentification(
         value=ContactIdentification(identification_type='BIRTHDAY', identification_data='2000-06-28'),
         disclose=True,
     )
     WHOIS.get_contact_by_handle.return_value = self._get_contact(identification=ident)
     WHOIS.get_registrar_by_handle.return_value = self._get_registrar()
     response = self.client.get(reverse("webwhois:detail_contact", kwargs={"handle": "mycontact"}))
     self.assertContains(response, "Contact details")
     self.assertContains(response, "Search results for handle <strong>mycontact</strong>:")
     self.assertEqual(response.context['registry_objects']['contact']['birthday'], date(2000, 6, 28))
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'mycontact'), ('handleType', 'contact'))),
         call.create_request().close(properties=[('foundType', 'contact')])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'Ok')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_contact_by_handle('mycontact'),
         call.get_contact_status_descriptions('en'),
         call.get_registrar_by_handle('REG-FRED_A'),
         call.get_registrar_by_handle('REG-FRED_A')
     ])
예제 #3
0
 def test_contact_without_registrars_handle(self):
     WHOIS.get_contact_status_descriptions.return_value = self._get_contact_status()
     WHOIS.get_contact_by_handle.return_value = self._get_contact(creating_registrar_handle="",
                                                                  sponsoring_registrar_handle="")
     response = self.client.get(reverse("webwhois:detail_contact", kwargs={"handle": "mycontact"}))
     self.assertContains(response, "Contact details")
     self.assertContains(response, "Search results for handle <strong>mycontact</strong>:")
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'mycontact'), ('handleType', 'contact'))),
         call.create_request().close(properties=[('foundType', 'contact')])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'Ok')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_contact_by_handle('mycontact'),
         call.get_contact_status_descriptions('en')
     ])
예제 #4
0
 def test_contact_linked(self):
     WHOIS.get_contact_status_descriptions.return_value = self._get_contact_status()
     WHOIS.get_contact_by_handle.return_value = self._get_contact()
     WHOIS.get_registrar_by_handle.return_value = self._get_registrar()
     response = self.client.get(reverse("webwhois:detail_contact", kwargs={"handle": "mycontact"}))
     self.assertContains(response, "Contact details")
     self.assertContains(response, "Search results for handle <strong>mycontact</strong>:")
     self.assertTrue(response.context['registry_objects']['contact']['is_linked'])
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'mycontact'), ('handleType', 'contact'))),
         call.create_request().close(properties=[('foundType', 'contact')])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'Ok')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_contact_by_handle('mycontact'),
         call.get_contact_status_descriptions('en'),
         call.get_registrar_by_handle('REG-FRED_A'),
         call.get_registrar_by_handle('REG-FRED_A')
     ])