class TestArgParsing(unittest.TestCase):
    """
    Tests for parsing arguments for the `migrate_to_split` management command
    """
    def setUp(self):
        self.command = Command()

    def test_no_args(self):
        errstring = "migrate_to_split requires at least two arguments"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle()

    def test_invalid_location(self):
        errstring = "Invalid location string"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("foo", "bar")

    def test_nonexistant_user_id(self):
        errstring = "No user found identified by 99"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("i4x://org/course/category/name", "99")

    def test_nonexistant_user_email(self):
        errstring = "No user found identified by [email protected]"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("i4x://org/course/category/name",
                                "*****@*****.**")
class TestArgParsing(unittest.TestCase):
    """
    Tests for parsing arguments for the `migrate_to_split` management command
    """
    def setUp(self):
        self.command = Command()

    def test_no_args(self):
        errstring = "migrate_to_split requires at least two arguments"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle()

    def test_invalid_location(self):
        errstring = "Invalid location string"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("foo", "bar")

    def test_nonexistant_user_id(self):
        errstring = "No user found identified by 99"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("i4x://org/course/category/name", "99")

    def test_nonexistant_user_email(self):
        errstring = "No user found identified by [email protected]"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("i4x://org/course/category/name", "*****@*****.**")
class TestArgParsing(unittest.TestCase):
    """
    Tests for parsing arguments for the `migrate_to_split` management command
    """

    def setUp(self):
        super(TestArgParsing, self).setUp()
        self.command = Command()

    def test_no_args(self):
        """
        Test the arg length error
        """
        errstring = "migrate_to_split requires at least two arguments"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle()

    def test_invalid_location(self):
        """
        Test passing an unparsable course id
        """
        errstring = "Invalid location string"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("foo", "bar")

    def test_nonexistent_user_id(self):
        """
        Test error for using an unknown user primary key
        """
        errstring = "No user found identified by 99"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("org/course/name", "99")

    def test_nonexistent_user_email(self):
        """
        Test error for using an unknown user email
        """
        errstring = "No user found identified by [email protected]"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("org/course/name", "*****@*****.**")
class TestArgParsing(TestCase):
    """
    Tests for parsing arguments for the `migrate_to_split` management command
    """
    def setUp(self):
        super(TestArgParsing, self).setUp()
        self.command = Command()

    def test_no_args(self):
        """
        Test the arg length error
        """
        errstring = "migrate_to_split requires at least two arguments"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle()

    def test_invalid_location(self):
        """
        Test passing an unparsable course id
        """
        errstring = "Invalid location string"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("foo", "bar")

    def test_nonexistent_user_id(self):
        """
        Test error for using an unknown user primary key
        """
        errstring = "No user found identified by 99"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("org/course/name", "99")

    def test_nonexistent_user_email(self):
        """
        Test error for using an unknown user email
        """
        errstring = "No user found identified by [email protected]"
        with self.assertRaisesRegexp(CommandError, errstring):
            self.command.handle("org/course/name", "*****@*****.**")
 def setUp(self):
     super(TestArgParsing, self).setUp()
     self.command = Command()
 def setUp(self):
     self.command = Command()
 def setUp(self):
     self.command = Command()
 def setUp(self):
     super(TestArgParsing, self).setUp()
     self.command = Command()