mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Checking for raising the correct exception and moved the strings used in the test to a list of strings
This commit is contained in:
parent
6aad1c44cc
commit
31f1bfef8d
1 changed files with 5 additions and 4 deletions
|
|
@ -4,6 +4,7 @@
|
|||
import unittest, os
|
||||
from categories.models import Category
|
||||
from categories.management.commands.import_categories import Command
|
||||
from django.core.management.base import CommandError
|
||||
|
||||
class CategoryImportTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
@ -39,11 +40,11 @@ class CategoryImportTest(unittest.TestCase):
|
|||
"""
|
||||
Should raise an exception.
|
||||
"""
|
||||
string1 = "cat1\n cat1-1\n\tcat1-2-FAIL!\n"
|
||||
string2 = "cat1\n\tcat1-1\n cat1-2-FAIL!\n"
|
||||
string1 = ["cat1"," cat1-1", "\tcat1-2-FAIL!",""]
|
||||
string2 = ["cat1","\tcat1-1"," cat1-2-FAIL!",""]
|
||||
cmd = Command()
|
||||
|
||||
# raise Exception
|
||||
self.assertRaises(cmd.parse_lines(string1), Command.CommandError)
|
||||
self.assertRaises(cmd.parse_lines(string2), Command.CommandError)
|
||||
self.assertRaises(CommandError, cmd.parse_lines, string1)
|
||||
self.assertRaises(CommandError, cmd.parse_lines, string2)
|
||||
|
||||
Loading…
Reference in a new issue