i got error message when trying to run the test of django this is my code for the model file
class MountPoint(models.Model):
name = models.CharField(max_length=100)
backend = models.CharField(max_length=200,default=DEFAULT_BACKEND)
path = models.CharField(max_length=300)
def __unicode__(self):
return self.name
and here is the class i put in test
class MountPoint(TestCase):
def create_mountpoint(self):
name = "test"
backend = "test"
path = user_root
return MountPoint(name, backend, path)
def test_mountpoint_creation(self):
m = self.create_mountpoint()
self.assertTrue(isinstance(m, MountPoint))
self.assertEqual(m.__unicode(), m.name)
and the error message i got is below. it said i have more inputs than expected.
Traceback (most recent call last): File "/Users/xihui/Documents/WebProgramming/django/ece264site/filesystem/tests.py", line 18, in test_mountpoint_creation m = self.create_mountpoint() File "/Users/xihui/Documents/WebProgramming/django/ece264site/filesystem/tests.py", line 15, in create_mountpoint return MountPoint(name, backend, path) TypeError: init() takes at most 2 arguments (4 given)
Ran 1 test in 0.009s
FAILED (errors=1)
Aucun commentaire:
Enregistrer un commentaire