Пример #1
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')
     ])
Пример #2
0
 def get_contact_by_handle(self, handle):
     print("{}.get_contact_by_handle({})".format(self.__class__.__name__,
                                                 handle))
     if handle == 'KOCHANSKI':
         raise OBJECT_NOT_FOUND()
     nothing = DisclosableString('', False)
     no_address = DisclosablePlaceAddress(
         PlaceAddress('', '', '', '', '', '', ''), False)
     no_ident = DisclosableContactIdentification(
         ContactIdentification('OP', ''), False)
     return Contact(handle, nothing, nothing, no_address, nothing, nothing,
                    nothing, nothing, nothing, no_ident, 'REGGIE', 'REGGIE',
                    IsoDateTime('1970-01-01T00:00:00Z'), None, None, [])
Пример #3
0
def get_contact():
    nothing = DisclosableString(value='', disclose=False)
    place = PlaceAddress(street1='', street2='', street3='', city='', stateorprovince='', postalcode='',
                         country_code='')
    address = DisclosablePlaceAddress(value=place, disclose=False)
    ident = DisclosableContactIdentification(
        value=ContactIdentification(identification_type='PASS', identification_data=''),
        disclose=False,
    )
    return Contact(
        handle='KRYTEN', organization=nothing, name=nothing, address=address, phone=nothing, fax=nothing, email=nothing,
        notify_email=nothing, vat_number=nothing, identification=ident, creating_registrar_handle='HOLLY',
        sponsoring_registrar_handle='LISTER', created=datetime(1980, 1, 4, 11, 14, 10), changed=None,
        last_transfer=None, statuses=[])
Пример #4
0
 def get_contact(self):
     address = PlaceAddress('', '', '', '', '', '', '')
     ident = ContactIdentification('OP', '')
     return Contact(
         'kryten',
         DisclosableString('', True),
         DisclosableString('', True),
         DisclosablePlaceAddress(address, True),
         DisclosableString('', True),
         DisclosableString('', True),
         DisclosableString('', True),
         DisclosableString('', True),
         DisclosableString('', True),
         DisclosableContactIdentification(ident, True),
         '',
         '',
         IsoDateTime('1988-09-06T20:00:00Z'),
         None,
         None,
         [])
Пример #5
0
 def _get_contact(self, **kwargs):
     disclose = kwargs.pop("disclose", True)
     address = PlaceAddress(street1='Street 756/48',
                            street2='',
                            street3='',
                            city='Prague',
                            stateorprovince='',
                            postalcode='12300',
                            country_code='CZ')
     obj = Contact(
         handle='KONTAKT',
         organization=DisclosableString(value='Company L.t.d.',
                                        disclose=disclose),
         name=DisclosableString(value='Arnold Rimmer', disclose=disclose),
         address=DisclosablePlaceAddress(value=address, disclose=disclose),
         phone=DisclosableString(value='+420.728012345', disclose=disclose),
         fax=DisclosableString(value='+420.728023456', disclose=disclose),
         email=DisclosableString(value='*****@*****.**', disclose=disclose),
         notify_email=DisclosableString(value='*****@*****.**',
                                        disclose=disclose),
         vat_number=DisclosableString(value='CZ456123789',
                                      disclose=disclose),
         identification=DisclosableContactIdentification(
             value=ContactIdentification(identification_type='OP',
                                         identification_data='333777000'),
             disclose=disclose,
         ),
         creating_registrar_handle='REG-FRED_A',
         sponsoring_registrar_handle='REG-FRED_A',
         created=IsoDateTime('2015-12-15T07:56:24Z'),
         changed=IsoDateTime('2015-12-16T08:32:12Z'),
         last_transfer=IsoDateTime('2015-12-17T09:48:25Z'),
         statuses=[STATUS_LINKED])
     field_names = obj.__dict__.keys()
     for key, value in kwargs.items():
         assert key in field_names, "Unknown arg '%s' in _get_contact." % key
         setattr(obj, key, value)
     return obj