Exemplo n.º 1
0
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")
Exemplo n.º 2
0
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")
Exemplo n.º 3
0
 def setUp(self):
     self.command = Command()
Exemplo n.º 4
0
    def setUp(self):
        super(TestArgParsing, self).setUp()

        self.command = Command()
Exemplo n.º 5
0
 def setUp(self):
     self.command = Command()
Exemplo n.º 6
0
    def setUp(self):
        super(TestArgParsing, self).setUp()

        self.command = Command()