Beispiel #1
0
 def testDELETE(self):
     """Complex join DELETE test (checks whether the join is really gone)"""
     client = tools.RESTclient()
     r = client.delete('/restms/resource/join_1')
     self.assertEqual(r.status_code, 200)
     r = client.get('/restms/resource/join_1')
     self.assertEqual(r.status_code, 404)
Beispiel #2
0
 def testDELETE(self):
     """Complex message DELETE test (checks whether the message is really gone)"""
     client = tools.RESTclient()
     for i in range(2,6):
         r = client.delete('/restms/resource/message_%s' % i)
         self.assertEqual(r.status_code, 200)
         r = client.get('/restms/resource/message_%s' % i)
         self.assertEqual(r.status_code, 404)
Beispiel #3
0
 def testPUTFail(self):
     """Simple pipe PUT fail test (not allowed)"""
     client = tools.RESTclient()
     r = client.put('/restms/resource/pipe_1', content_type="restms+xml",
                         data = """ <?xml version="1.0"?>
                                    <restms xmlns="http://www.restms.org/schema/restms">
                                         <pipe type="" title="fail test" />
                                     </restms>
                                 """)
     self.assertEqual(r.status_code, 405)
Beispiel #4
0
 def testPOSTFail(self):
     """Simple content POST fail test (not allowed)"""
     client = tools.RESTclient()
     r = client.post('/restms/resource/message_1',
                     content_type="restms+xml",
                     data="""<?xml version="1.0"?>
                        <restms xmlns="http://www.restms.org/schema/restms">
                             <content type="text/plain" encoding="ascii" >Just testing.</content>
                        </restms>
                    """)
     self.assertEqual(r.status_code, 405)
Beispiel #5
0
 def testPUTFail(self):
     """Simple domain PUT fail test (not allowed for domains)"""
     client = tools.RESTclient()
     r = client.put('/restms/domain/Serenity',
                    content_type="restms+xml",
                    data="""<?xml version="1.0"?>
                        <restms xmlns="http://www.restms.org/schema/restms">
                           <domain title="DOMAIN PUT FAIL TEST">
                           </domain>
                        </restms>
                    """)
     self.assertEqual(r.status_code, 405)
Beispiel #6
0
 def testPUTFail(self):
     """Simple join PUT fail test (not allowed)"""
     client = tools.RESTclient()
     r = client.put('/restms/resource/join_2',
                    content_type="restms+xml",
                    data="""<?xml version="1.0"?>
                        <restms xmlns="http://www.restms.org/schema/restms">
                           <join address="server.*"
                             feed="http://testserver/restms/feed/Announcements>"
                           </join>
                        </restms>
                    """)
     self.assertEqual(r.status_code, 405)
Beispiel #7
0
 def testPOSTFail(self):
     """Simple join POST fail test (not allowed)"""
     client = tools.RESTclient()
     r = client.post('/restms/resource/join_2',
                     content_type="restms+xml",
                     data="""<?xml version="1.0"?>
                        <restms xmlns="http://www.restms.org/schema/restms">
                         <message
                             address="alt.rec.misc"
                             message_id="0815-4711-12345"
                             reply_to="/dev/null" />
                        </restms>
                    """)
     self.assertEqual(r.status_code, 405)
Beispiel #8
0
 def testPUTFail(self):
     """Simple message PUT fail test (not allowed)"""
     client = tools.RESTclient()
     r = client.put('/restms/resource/message_1',
             content_type="restms+xml",
             data = """<?xml version="1.0"?>
                         <restms xmlns="http://www.restms.org/schema/restms">
                             <message>
                                 <header name="funny header" value="123" />
                                 <content type="text/cmd" encoding="ascii" >Do something! NOW!</content>
                             </message>
                         </restms>
                    """)
     self.assertEqual(r.status_code, 405)
Beispiel #9
0
 def testDELETEFail(self):
     """Simple content DELETE fail test on embedded content"""
     client = tools.RESTclient()
     r = client.delete('/restms/resource/content_1')
     self.assertEqual(r.status_code, 400)
Beispiel #10
0
 def testDELETEFail(self):
     """Simple domain DELETE fail test (not allowed for domains)"""
     client = tools.RESTclient()
     r = client.delete('/restms/domain/Serenity')
     self.assertEqual(r.status_code, 405)