Ejemplo n.º 1
0
 def _get_send_password_form(self, pubreq):
     form = SendPasswordForm({
         "object_type": "domain",
         "handle": "foo.cz",
         "confirmation_method": "signed_email",
         "send_to_0": "email_in_registry",
     })
     self.assertTrue(form.is_valid())
     return form
Ejemplo n.º 2
0
 def test_get_log_properties(self: SimpleTestCase):
     data = (
         # post, properties
         ({
             'object_type': 'contact',
             'handle': 'kryten',
             'send_to_0': 'email_in_registry'
         }, [('handle', 'kryten'), ('handleType', 'contact'),
             ('sendTo', 'email_in_registry')]),
         ({
             'object_type': 'contact',
             'handle': 'kryten',
             'send_to_0': 'custom_email',
             'send_to_1': '*****@*****.**'
         }, [('handle', 'kryten'), ('handleType', 'contact'),
             ('sendTo', 'custom_email'),
             ('customEmail', '*****@*****.**')]),
     )
     for post, properties in data:
         with self.subTest(post=post):
             form = SendPasswordForm(post)
             form.is_valid()
             self.assertEqual(form.get_log_properties(), properties)
Ejemplo n.º 3
0
 def test_logged_call_to_registry_no_logger(self, mock_localdate):
     mock_localdate.return_value = datetime(2017, 3, 8)
     pubreq = DebugPublicRequest()
     form = SendPasswordForm({
         "object_type": "domain",
         "handle": "foo.cz",
         "confirmation_method": "signed_email",
         "send_to_0": "email_in_registry",
     })
     self.assertTrue(form.is_valid())
     pubreq.logged_call_to_registry(form)
     cleaned_data = {
         'handle': 'foo.cz',
         'object_type': 'domain',
         'confirmation_method': ConfirmationMethod.SIGNED_EMAIL,
         'send_to': DeliveryType('email_in_registry', ''),
     }
     self.assertEqual(cache.get(pubreq.public_key), {
         'cleaned_data': cleaned_data,
         'public_request_id': 42
     })
     self.assertEqual(self.LOGGER.mock_calls, [])