示例#1
0
 def test_ftd_desc1(self):
     command = "course edit desc=Its fun to drive"
     output = {
         'command': 'course',
         'action': 'edit',
         'desc': 'Its fun to drive'
     }
     self.assertDictEqual(views.fieldsToDict(command), output)
示例#2
0
 def test_ftd_desc3(self):
     command = "course edit dnum=CS desc=Its fun to drive cnum=351"
     output = {
         'cnum': '351',
         'dnum': 'CS',
         'command': 'course',
         'action': 'edit',
         'desc': 'Its fun to drive'
     }
     self.assertDictEqual(views.fieldsToDict(command), output)
示例#3
0
 def test_ftd_code2(self):
     command = "course edit code=CS-550 ins=Danny"
     output = {
         'dnum': 'CS',
         'cnum': '550',
         'command': 'course',
         'action': 'edit',
         'ins': 'Danny'
     }
     self.assertDictEqual(views.fieldsToDict(command), output)
示例#4
0
 def test_ftd_code1(self):
     command = "course add code=CS-351-601"
     output = {
         'dnum': 'CS',
         'cnum': '351',
         'snum': '601',
         'command': 'course',
         'action': 'add'
     }
     self.assertDictEqual(views.fieldsToDict(command), output)
示例#5
0
 def test_ftd_code_desc2(self):
     command = "course edit ins=Dan code=CS-351-601 desc=Its fun to drive"
     output = {
         'cnum': '351',
         'dnum': 'CS',
         'snum': '601',
         'command': 'course',
         'action': 'edit',
         'desc': 'Its fun to drive',
         'ins': 'Dan'
     }
     self.assertDictEqual(views.fieldsToDict(command), output)
示例#6
0
 def test_val_sup4(self):
     command = views.fieldsToDict("course edit code=CS-351 ins=ins1")
     self.assertTrue(views.validate(command, self.UserDict['sup']))
示例#7
0
 def test_val_sup3(self):
     command = views.fieldsToDict("section edit code=CS-351 ta=ta1")
     self.assertTrue(views.validate(command, self.UserDict['sup']))
示例#8
0
 def test_val_sup2(self):
     command = views.fieldsToDict("user edit")
     self.assertTrue(views.validate(command, self.UserDict['sup']))
示例#9
0
 def test_val_sup1(self):
     command = views.fieldsToDict("course create")
     self.assertTrue(views.validate(command, self.UserDict['sup']))
示例#10
0
 def test_val_admin4(self):
     command = views.fieldsToDict("course edit ins=ins1")
     self.assertFalse(views.validate(command, self.UserDict['admin']))
示例#11
0
 def test_val_ta1(self):
     command = views.fieldsToDict("user edit username=default")
     self.assertTrue(views.validate(command, self.UserDict['ta']))
示例#12
0
 def test_val_ins4(self):
     command = views.fieldsToDict("section add")
     self.assertFalse(views.validate(command, self.UserDict['ins']))
示例#13
0
 def test_val_ins2(self):
     command = views.fieldsToDict("section view")
     self.assertTrue(views.validate(command, self.UserDict['ins']))
示例#14
0
 def test_val_ta4(self):
     command = views.fieldsToDict("section edit code=CS-351 ta=default")
     self.assertFalse(views.validate(command, self.UserDict['ta']))
示例#15
0
 def test_val_ta3(self):
     command = views.fieldsToDict("user add")
     self.assertFalse(views.validate(command, self.UserDict['ta']))
示例#16
0
 def test_val_ta2(self):
     command = views.fieldsToDict("course view")
     self.assertTrue(views.validate(command, self.UserDict['ta']))
示例#17
0
 def test_val_admin3(self):
     command = views.fieldsToDict("section edit ta=ta1")
     self.assertFalse(views.validate(command, self.UserDict['admin']))
示例#18
0
 def test_val_admin1(self):
     command = views.fieldsToDict("course add")
     self.assertTrue(views.validate(command, self.UserDict['admin']))
示例#19
0
 def test_val_default4(self):
     command = views.fieldsToDict("course add")
     self.assertFalse(views.validate(command, self.UserDict['default']))