def index(self): event_server = config['base_conf'].get('applications', 'cabochon uri') login_file = config['cabochon_password_file'] username, password = file(login_file).read().strip().split(":") installer = ServerInstaller(".servers", username, password) installer.addEvent(event_server, 'create_page', h.url_for(controller='page', action='create', qualified=True)) installer.addEvent(event_server, 'edit_page', h.url_for(controller='page', action='edit', qualified=True)) installer.addEvent(event_server, 'delete_page', h.url_for(controller='page', action='delete', qualified=True)) installer.addEvent(event_server, 'email_changed', h.url_for(controller='page', action='email_changed', qualified=True)) installer.save() return "OK, you're configured. Go have fun."
server_url = "http://localhost:24532" try: status, body = rest_invoke(server_url + "/event/", method="GET", resp=True) except socket.error, e: raise RuntimeError("You need a Cabochon server running on port 24532", e) if status['status'] != '200': raise RuntimeError("You need a Cabochon server running on port 24532") event_name = "cabochon_server_library_test_event" installer = ServerInstaller(".servers", username=username, password=password) installer.addEvent(server_url, event_name, "http://localhost:10424/example/1") installer.save() #get the fire url urls = fromjson(rest_invoke(server_url + "/event", method="POST", params={'name':event_name})) fire_url = urls['fire'] #fire the event rest_invoke(server_url + fire_url, method="POST", params={'morx':'fleem'}) #wait a second time.sleep(1) #insure that we got it assert server_fixture.requests_received == [{'path': '/example/1', 'params': MultiDict([('morx', '"fleem"')]), 'method': 'POST'}], "Actually got %s" % server_fixture.requests_received installer2 = ServerInstaller(".servers")