コード例 #1
0
 def doPrepareCreate(self, *args, **kwargs):
     """
     Action method.
     """
     self.contact_info = zcontacts.to_dict(self.target_contact)
     self.contact_info['id'] = zclient.make_epp_id(
         self.contact_info['email'])
コード例 #2
0
def test_contact_update():
    if os.environ.get('E2E', '0') != '1':
        return pytest.skip('skip E2E')  # @UndefinedVariable
    tester_contact = testsupport.prepare_tester_contact()
    existing_contact_id = rpc_client.make_epp_id(tester_contact.contact_email)
    existing_contact_info = zcontacts.to_dict(tester_contact)
    create_response = rpc_client.cmd_contact_create(
        contact_id=existing_contact_id,
        email=existing_contact_info['email'],
        voice=existing_contact_info['voice'],
        fax=existing_contact_info['fax'],
        # auth_info=auth_info,
        contacts_list=existing_contact_info['contacts'],
        raise_for_result=False,
    )
    assert create_response['epp']['response']['result']['@code'] == '1000'
    tester_contact.epp_id = existing_contact_id
    tester_contact.person_name = 'Tester Tester ' + str(int(time.time()))
    tester_contact.save()
    scenario = []
    cs = contact_synchronizer.ContactSynchronizer(
        log_events=True,
        log_transitions=True,
    )
    cs.add_state_changed_callback(
        cb=lambda oldstate, newstate, event, *args, **kwargs: scenario.append((
            oldstate,
            newstate,
            event,
        )),
    )
    cs.event('run', tester_contact)
    outputs = list(cs.outputs)
    del cs
    assert tester_contact.epp_id != ''
    delete_response = rpc_client.cmd_contact_delete(tester_contact.epp_id)
    assert delete_response['epp']['response']['result']['@code'] == '1000'
    tester_contact.epp_id = None
    tester_contact.save()
    assert scenario == [
        ('AT_STARTUP', 'CONTACT_UPDATE', 'run'),
        ('CONTACT_UPDATE', 'DONE', 'response'),
    ]
    assert len(outputs) == 1
    assert outputs[0]['epp']['response']['result']['@code'] == '1000'
コード例 #3
0
 def doPrepareUpdate(self, *args, **kwargs):
     """
     Action method.
     """
     self.contact_info = zcontacts.to_dict(self.target_contact)
     self.contact_info['id'] = self.target_contact.epp_id