def test_set_email_to_config_file(self, tmpdir): server_config = self._setup_server_config(oprp_dir_path=str(tmpdir)) ports = [8001, 8002, 8003, 8004] existing_key = "srv_discovery_url" client_attribute = json.dumps({existing_key: 'https://example.com'}) self._create_temp_config_module_files(ports, tmpdir, client_attribute=client_attribute) set_email_to_file(ports[:3], "*****@*****.**", server_config) for port in ports[:3]: config_module = identify_existing_config_file(port, server_config.OPRP_DIR_PATH) assert CONTACT_EMAIL in config_module assert existing_key in config_module config_module = identify_existing_config_file(8004, server_config.OPRP_DIR_PATH) assert CONTACT_EMAIL not in config_module
def handle_submit_contact_info(response_encoder, parameters): if 'issuer' not in parameters or 'email' not in parameters: return response_encoder.bad_request() issuer = parameters['issuer'] email = parameters['email'] port_db = PortDatabase(CONF.PORT_DATABASE_FILE) port_db.set_email_info(issuer, email) ports = port_db.get_ports(issuer) set_email_to_file(ports, email, CONF) return_info = {'issuer': issuer, 'existing_email': email} return response_encoder.return_json(json.dumps(return_info))