示例#1
0
    def test_nsset(self):
        with patch.object(WHOIS, 'client', spec=('get_nsset_by_handle', )) as whois_mock:
            whois_mock.get_nsset_by_handle.return_value = get_nsset()

            result = domain_to_dict(self.request, get_domain(nsset_handle='new-saturn'))

        self.assertEqual(result['fred_nsset']['links'][0]['value'], 'http://rdap.example/fred_nsset/new-saturn')
示例#2
0
    def test_nameservers(self):
        nservers = [NameServer(fqdn='nameserver.example.cz', ip_addresses=[])]
        with patch.object(WHOIS, 'client', spec=('get_nsset_by_handle', )) as whois_mock:
            whois_mock.get_nsset_by_handle.return_value = get_nsset(nservers=nservers)

            result = domain_to_dict(self.request, get_domain(nsset_handle='new-saturn'))

        self.assertEqual(result['nameservers'][0]['links'][0]['value'],
                         'http://rdap.example/nameserver/nameserver.example.cz')
示例#3
0
 def test_admin_contacts(self):
     result = domain_to_dict(self.request, get_domain(admin_contact_handles=['HOLLY']))
     admin = result['entities'][2]
     self.assertEqual(admin['roles'], ['administrative'])
     self.assertEqual(admin['links'][0]['value'], 'http://rdap.example/entity/HOLLY')
示例#4
0
 def test_simple(self):
     result = domain_to_dict(self.request, get_domain())
     self.assertEqual(result['links'][0]['value'], 'http://rdap.example/domain/example.cz')
     self.assertEqual(result['entities'][0]['links'][0]['value'], 'http://rdap.example/entity/KRYTEN')
     self.assertNotIn('port43', result)
示例#5
0
 def test_max_sig_life_present(self):
     with patch.object(WHOIS, 'client', spec=('get_keyset_by_handle', )) as whois_mock:
         whois_mock.get_keyset_by_handle.return_value = get_keyset()
         with self.settings(RDAP_MAX_SIG_LIFE=sentinel.max_sig_life):
             result = domain_to_dict(self.request, get_domain(keyset_handle='gazpacho'))
     self.assertEqual(result['secureDNS']['maxSigLife'], sentinel.max_sig_life)
示例#6
0
 def test_port43(self):
     with override_settings(RDAP_UNIX_WHOIS='whois.example.com'):
         result = domain_to_dict(self.request, get_domain())
     self.assertEqual(result['port43'], 'whois.example.com')