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)
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)
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)
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)
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)
def test_val_sup4(self): command = views.fieldsToDict("course edit code=CS-351 ins=ins1") self.assertTrue(views.validate(command, self.UserDict['sup']))
def test_val_sup3(self): command = views.fieldsToDict("section edit code=CS-351 ta=ta1") self.assertTrue(views.validate(command, self.UserDict['sup']))
def test_val_sup2(self): command = views.fieldsToDict("user edit") self.assertTrue(views.validate(command, self.UserDict['sup']))
def test_val_sup1(self): command = views.fieldsToDict("course create") self.assertTrue(views.validate(command, self.UserDict['sup']))
def test_val_admin4(self): command = views.fieldsToDict("course edit ins=ins1") self.assertFalse(views.validate(command, self.UserDict['admin']))
def test_val_ta1(self): command = views.fieldsToDict("user edit username=default") self.assertTrue(views.validate(command, self.UserDict['ta']))
def test_val_ins4(self): command = views.fieldsToDict("section add") self.assertFalse(views.validate(command, self.UserDict['ins']))
def test_val_ins2(self): command = views.fieldsToDict("section view") self.assertTrue(views.validate(command, self.UserDict['ins']))
def test_val_ta4(self): command = views.fieldsToDict("section edit code=CS-351 ta=default") self.assertFalse(views.validate(command, self.UserDict['ta']))
def test_val_ta3(self): command = views.fieldsToDict("user add") self.assertFalse(views.validate(command, self.UserDict['ta']))
def test_val_ta2(self): command = views.fieldsToDict("course view") self.assertTrue(views.validate(command, self.UserDict['ta']))
def test_val_admin3(self): command = views.fieldsToDict("section edit ta=ta1") self.assertFalse(views.validate(command, self.UserDict['admin']))
def test_val_admin1(self): command = views.fieldsToDict("course add") self.assertTrue(views.validate(command, self.UserDict['admin']))
def test_val_default4(self): command = views.fieldsToDict("course add") self.assertFalse(views.validate(command, self.UserDict['default']))