Exemplo n.º 1
0
 def test_idn_domain_punycode(self):
     self._mocks_for_domain_detail(handle="xn--frd-cma.cz")
     response = self.client.get(reverse("webwhois:detail_domain", kwargs={"handle": "xn--frd-cma.cz"}))
     self.assertContains(response, "Search results for handle <strong>xn--frd-cma.cz</strong>:")
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'xn--frd-cma.cz'), ('handleType', 'domain'))),
         call.create_request().close(properties=[('foundType', 'domain')])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'Ok')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_domain_by_handle('xn--frd-cma.cz'),
         call.get_domain_status_descriptions('en'),
         call.get_contact_by_handle('KONTAKT'),
         call.get_registrar_by_handle('REG-FRED_A'),
         call.get_contact_by_handle('KONTAKT'),
         call.get_nsset_by_handle('NSSET-1'),
         call.get_nsset_status_descriptions('en'),
         call.get_contact_by_handle('KONTAKT'),
         call.get_registrar_by_handle('REG-FRED_A'),
         call.get_keyset_by_handle('KEYSID-1'),
         call.get_keyset_status_descriptions('en'),
         call.get_contact_by_handle('KONTAKT'),
         call.get_registrar_by_handle('REG-FRED_A')
     ])
Exemplo n.º 2
0
 def test_multiple_entries(self):
     WHOIS.get_contact_status_descriptions.return_value = self._get_contact_status()
     WHOIS.get_contact_by_handle.return_value = self._get_contact()
     WHOIS.get_nsset_status_descriptions.return_value = self._get_nsset_status()
     WHOIS.get_nsset_by_handle.return_value = self._get_nsset()
     WHOIS.get_keyset_status_descriptions.return_value = self._get_keyset_status()
     WHOIS.get_keyset_by_handle.return_value = self._get_keyset()
     WHOIS.get_registrar_by_handle.return_value = self._get_registrar()
     WHOIS.get_domain_status_descriptions.return_value = self._get_domain_status()
     WHOIS.get_domain_by_handle.return_value = self._get_domain()
     response = self.client.get(reverse("webwhois:registry_object_type", kwargs={"handle": "testhandle.cz"}))
     self.assertContains(response, "Multiple entries found")
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'testhandle.cz'), ('handleType', 'multiple'))),
         call.create_request().close(properties=[
             ('foundType', 'contact'),
             ('foundType', 'domain'),
             ('foundType', 'keyset'),
             ('foundType', 'nsset'),
             ('foundType', 'registrar'),
         ])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'Ok')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_contact_by_handle('testhandle.cz'),
         call.get_nsset_by_handle('testhandle.cz'),
         call.get_keyset_by_handle('testhandle.cz'),
         call.get_registrar_by_handle('testhandle.cz'),
         call.get_domain_by_handle('testhandle.cz')
     ])
Exemplo n.º 3
0
 def test_nsset_invalid_handle(self):
     WHOIS.get_nsset_by_handle.side_effect = INVALID_HANDLE
     response = self.client.get(reverse("webwhois:detail_nsset", kwargs={"handle": "mynssid"}))
     self.assertContains(response, "Invalid handle")
     self.assertContains(response, "<strong>mynssid</strong> is not a valid handle.")
     self.assertNotContains(response, 'Register this domain name?')
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'mynssid'), ('handleType', 'nsset'))),
         call.create_request().close(properties=[('reason', 'INVALID_HANDLE')])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'NotFound')
     self.assertEqual(WHOIS.mock_calls, [call.get_nsset_by_handle('mynssid')])
Exemplo n.º 4
0
 def test_nsset_not_found(self):
     WHOIS.get_nsset_by_handle.side_effect = OBJECT_NOT_FOUND
     response = self.client.get(reverse("webwhois:detail_nsset", kwargs={"handle": "mynssid"}))
     self.assertContains(response, 'Name server set not found')
     self.assertContains(response, 'No name server set matches <strong>mynssid</strong> handle.')
     self.assertNotContains(response, 'Register this domain name?')
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'mynssid'), ('handleType', 'nsset'))),
         call.create_request().close(properties=[])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'NotFound')
     self.assertEqual(WHOIS.mock_calls, [call.get_nsset_by_handle('mynssid')])
Exemplo n.º 5
0
 def test_handle_with_dash_not_found(self):
     WHOIS.get_contact_by_handle.side_effect = OBJECT_NOT_FOUND
     WHOIS.get_nsset_by_handle.side_effect = OBJECT_NOT_FOUND
     WHOIS.get_keyset_by_handle.side_effect = OBJECT_NOT_FOUND
     WHOIS.get_registrar_by_handle.side_effect = OBJECT_NOT_FOUND
     WHOIS.get_managed_zone_list.return_value = []
     response = self.client.get(reverse("webwhois:registry_object_type", kwargs={"handle": "-abc"}))
     self.assertContains(response, "Record not found")
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', '-abc'), ('handleType', 'multiple'))),
         call.create_request().close(properties=[])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'NotFound')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_contact_by_handle('-abc'),
         call.get_nsset_by_handle('-abc'),
         call.get_keyset_by_handle('-abc'),
         call.get_registrar_by_handle('-abc'),
         call.get_managed_zone_list(),
     ])
Exemplo n.º 6
0
 def test_nsset_fqds_idna(self):
     WHOIS.get_contact_status_descriptions.return_value = self._get_contact_status()
     WHOIS.get_contact_by_handle.return_value = self._get_contact()
     WHOIS.get_nsset_status_descriptions.return_value = self._get_nsset_status()
     WHOIS.get_nsset_by_handle.return_value = self._get_nsset(fqdn1='xn--hkyrky-ptac70bc.cz', fqdn2='xn--frd-cma.cz')
     WHOIS.get_registrar_by_handle.return_value = self._get_registrar()
     response = self.client.get(reverse("webwhois:detail_nsset", kwargs={"handle": "mynssid"}))
     self.assertContains(response, "Name server set (DNS) details")
     self.assertContains(response, "Search results for handle <strong>mynssid</strong>:")
     self.assertEqual(self.LOGGER.mock_calls, [
         CALL_BOOL,
         call.create_request('127.0.0.1', 'Web whois', 'Info', properties=(
             ('handle', 'mynssid'), ('handleType', 'nsset'))),
         call.create_request().close(properties=[('foundType', 'nsset')])
     ])
     self.assertEqual(self.LOGGER.create_request().result, 'Ok')
     self.assertEqual(WHOIS.mock_calls, [
         call.get_nsset_by_handle('mynssid'),
         call.get_nsset_status_descriptions('en'),
         call.get_contact_by_handle('KONTAKT'),
         call.get_registrar_by_handle('REG-FRED_A')
     ])