class TestArgParsing(unittest.TestCase): """ Tests for parsing arguments for the `create_course` management command """ def setUp(self): self.command = Command() def test_no_args(self): errstring = "create_course requires 5 arguments" with self.assertRaisesRegexp(CommandError, errstring): self.command.handle('create_course') def test_invalid_store(self): with self.assertRaises(CommandError): self.command.handle("foo", "*****@*****.**", "org", "course", "run") def test_xml_store(self): with self.assertRaises(CommandError): self.command.handle(ModuleStoreEnum.Type.xml, "*****@*****.**", "org", "course", "run") def test_nonexistent_user_id(self): errstring = "No user 99 found" with self.assertRaisesRegexp(CommandError, errstring): self.command.handle("split", "99", "org", "course", "run") def test_nonexistent_user_email(self): errstring = "No user [email protected] found" with self.assertRaisesRegexp(CommandError, errstring): self.command.handle("mongo", "*****@*****.**", "org", "course", "run")
def setUp(self): self.command = Command()
def setUp(self): super(TestArgParsing, self).setUp() self.command = Command()