Thanks for your help. I read that we need to define methods as
clean_<fieldname> however I missed
I was cleaning multiple fields. For the listname method it works the way
you told me but I tried something
similar ( http://pastebin.com/p40A19hU ) and it didn't work. If you could
tell me why is that?
Also I'm still puzzled when I run
tox -e py27-django1.7 -- postorius.tests.test_forms.UserNewTest
tox -e py27-django1.7 -- postorius.tests.test_forms.ListNewTest
tox -e py27-django1.7 -- postorius.tests.test_forms.DomainNewTest
Hi Pranjal,
I was able to run the tests in ListNewTest, and kind of debug the
other test too.
In ListNewTest you have two tests doing the same thing, probably you
intended
at doing something else, but there is nothing in there right now.
there is a method of django forms called as errors
. So you can simply do
print form.errors
and get the actual error in the forms printed when you run the tests. When
I ran
that I got "Passwords are not identical" error. Then I saw you changed
the clean
method in UserNew to clean_password
. According to django
documentation1 when
you are trying to access more than one field for cleaning you have to
use clean
method and not clean_<fieldname>
method. Like clean_email
method is
cool!
If you print the errors for test_form_fields_listname
method, you'd see
that
it says that 'mailman.most-desirable.org' is not a valid choice. So you
need to
first create a domain with that host in setUp
method of ListNewTest
.
I hope that helps!
On 20 February 2015 at 07:26, Pranjal Yadav <godricglow@gmail.com> wrote:
I started writing tests to improve the coverage for postorius and I ran
into few problems which I couldn't solve for past few days. I added few
new
test cases and re-ran tox. It seems somehow none of the tests ran
although
the tox output says "ran 11 tests in 72.332s, failures = 3"
Here is the link to my tests : http://pastebin.com/1jLhVsr2
I did change a few things in forms.py : http://pastebin.com/2P3vXW7W
After running these tests I realized UserNewTest and ListNewTest never
runs, though tox outputs it ran 11 test and failed 3 (mainly the
assertTrue
for listname, password and email methods), when I tried tox -e
py27-django1.7 -- postorius.tests.test_forms.UserNewTest, it says 0 tests
ran in 0.001s
- So I don't understand why the assertTrue validation is failing though
all the inputs to the form is prefect? I talked to Aurelien and Abhliash
and also followed (
https://docs.djangoproject.com/en/1.7/ref/forms/validation/#validating-field...
)
however it left me with the same situation.
If the tests run with tox then why do they not run when a particular
testcase is tested?
I discussed this problem with Aurelien and he mentioned "Form class
shouldn't do anything in its __init__ function" however we do have
__inti__
functions in our forms.py. So do we need to modify something there?
--
*Pranjal Yadav*
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives:
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe:
https://mail.python.org/mailman/options/mailman-developers/raj.abhilash1%40g...
Security Policy: http://wiki.list.org/x/QIA9
--
thanks,
Abhilash Raj