Exemple #1
0
 def testBadForm(self):
     """ Required form fields are missing -> bad form message. """
     #only a password
     form = cgifactory.get(**{'pass': '******'})
     response = self.query(upload.main, form)
     #print(response)
     self.assertIn('BAD_SUBMITTED_FORM', response)
Exemple #2
0
 def testGoodSubmission(self):
     """ Required form fields are missing -> bad form message. """
     #only a password
     form = cgifactory.get(uploaded=self.file) 
     response = self.query(submit.main, form)
     #print(response)
     self.assertIn("Submission completed successfully", response)
     self.assertIn("disabled", response)  # gradepipe was really off?
Exemple #3
0
 def testBadContext(self):
     """ Various context problems -> appropriate message. """
     tests = {
         'A01': 'BAD_SUBMITTED_FORM',
         'JohndoeA99.java': 'NO_UPLOADED_FILE',
     }
     for file, error in tests.items():
         form = cgifactory.get(uploaded=file) 
         response = self.query(submit.main, form)
         #print(response)
         self.assertIn(error, response)
Exemple #4
0
 def testDefault(self):
     """ No arguments -> print an input form."""
     form = cgifactory.get()
     response = self.query(upload.main, form)
     #print(response)
     self.assertIn('<form', response)
Exemple #5
0
 def testBadForm(self):
     """ Required form fields are missing -> bad form message. """
     form = cgifactory.get(upload=self.file)  #should be uploaded=
     response = self.query(submit.main, form)
     #print(response)
     self.assertIn('BAD_SUBMITTED_FORM', response)