Esempio n. 1
0
def put(request, queue_name):
    # test post with
    # curl -i http://localhost:8000/q/default/put/ -d message=hello
    try:
        q = Queue.objects.get(name=queue_name)
        msg = Message(message=request.POST['message'], queue=q)
        msg.save()
        return HttpResponse("OK", mimetype='text/plain')
    except Queue.DoesNotExist:
        return HttpResponseNotFound()
Esempio n. 2
0
 def testDefaultValues( self ):
     dq = Queue.objects.get( name='default' )
     x = Message( message="hello",queue=dq )
     x.save()
     self.failUnlessEqual( x.message, 'hello' )
     self.failIfEqual( x.timestamp, None )
     self.failUnlessEqual(x.visible, True)
     
     x = Message(queue=dq)
     x.save()
     self.failUnlessEqual( x.message, '' )
     self.failUnlessEqual( x.visible, True )