from django.test import TestCase from django.core import management from django.core.management.base import CommandError # Create your tests here. class ImportGPXManagementTest(TestCase): fixtures = ['tracking_test_fixtures.json',] def test_user_does_not_exist(self): with self.assertRaisesMessage(CommandError, "User THISUSERWONTEXIST does not exist"): management.call_command('import_gpx', 'THISUSERWONTEXIST', 'foo') def test_path_exists(self): with self.assertRaisesMessage(CommandError, "/noop/nodir/ is neither an existing file, nor a path."): management.call_command('import_gpx', 'tyrel', '/noop/nodir/')