class TestArgParsing(unittest.TestCase): """ Tests for parsing arguments for the `rollback_split_course` management command """ def setUp(self): self.command = Command() def test_no_args(self): errstring = "rollback_split_course requires at least one argument" with self.assertRaisesRegexp(CommandError, errstring): self.command.handle() def test_invalid_locator(self): errstring = "Invalid locator string !?!" with self.assertRaisesRegexp(CommandError, errstring): self.command.handle("!?!")
def setUp(self): self.command = Command()
def test_nonexistent_locator(self): locator = loc_mapper().translate_location(self.old_course.id, self.old_course.location) errstring = "No course found with locator" with self.assertRaisesRegexp(CommandError, errstring): Command().handle(str(locator))
def test_no_old_course(self): locator = self.course.location errstring = "course does not exist in the old Mongo store" with self.assertRaisesRegexp(CommandError, errstring): Command().handle(str(locator))