Skip to content
Snippets Groups Projects
Commit f08dc428 authored by David Baumgold's avatar David Baumgold
Browse files

Add some dummy arg parsing tests

parent bbec6266
No related merge requests found
"""
Unittests for importing a course via management command
"""
import unittest
from django.core.management import CommandError
from contentstore.management.commands.migrate_to_split import Command
class TestArgParsing(unittest.TestCase):
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 exists with ID 99"
with self.assertRaisesRegexp(CommandError, errstring):
self.command.handle("i4x://org/course/category/name", "99")
def test_nonexistant_user_email(self):
errstring = "No user exists with email fake@example.com"
with self.assertRaisesRegexp(CommandError, errstring):
self.command.handle("i4x://org/course/category/name", "fake@example.com")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment