Re: Testing django

2023-03-16 Thread Ayush Bisht
Yeah, I got you.. My concern is on the documentation, the way it has provided the commands for executing test cases. That path.to.settings seems confusing sometimes.. On Fri, 17 Mar, 2023, 1:20 am Bhuvnesh Sharma, wrote: > We can run django tests with custom settings by using --settings flag an

Re: Testing django

2023-03-16 Thread Bhuvnesh Sharma
We can run django tests with custom settings by using --settings flag and providing the path to the custom settings file . For example: ./runtests.py --settings=new_app.test_settings What do you want to do exactly? On Fri, Mar 17, 2023 at 1:00 AM Ayush Bisht wrote: > Seems like, it is for defin

Re: Testing django

2023-03-16 Thread Ayush Bisht
Seems like, it is for defining how actually we are selecting the specific test case. It is very confusing at first. Can't we just explain it with an example.. On Friday, March 17, 2023 at 12:54:27 AM UTC+5:30 Ayush Bisht wrote: > * ./runtests.py --settings=path.to.settings i18n.tests.Translatio

Testing django

2023-03-16 Thread Ayush Bisht
* ./runtests.py --settings=path.to.settings i18n.tests.TranslationTests* what exactly is the purpose of *path.to.settings,* I'm getting an error while running the above line. Can anyone please explain? *Error* Testing against Django installed in '/home/ayush/OS/django/django' with up to 8 pro

Re: Testing Django User Login Form

2021-04-23 Thread lone...@gmail.com
Thank you for the reply! I will totally try this tonight! On Thursday, April 22, 2021 at 7:31:40 PM UTC-4 David Nugent wrote: > Try creating a request using RequestFactory and use that to input the > credentials. I don't think the way you are creating the form is valid. > > rf = RequestFactory(

Re: Testing Django User Login Form

2021-04-22 Thread David Nugent
Try creating a request using RequestFactory and use that to input the credentials. I don't think the way you are creating the form is valid. rf = RequestFactory() request = rf.post('/some_mock_url', dict(username='abc', password='password')) form = AuthenticationForm(request) -- You received thi

Testing Django User Login Form

2021-04-18 Thread lone...@gmail.com
Hello all, I am not sure what I am doing incorrectly with the below test case information. I am simply trying to test the default authentication form of django 3.1. This test should be a good/True login test. Here is the Test case:- class TestForms(TestCase): def test_

Re: Unit-Testing Django Views

2019-03-30 Thread Jorge Gimeno
The online version of the book is pinned to Django 1.11. You may want to check that out. -Jorge On Sat, Mar 30, 2019 at 4:40 AM Test Bot wrote: > Sorry for the bother but I finally solved it by using Django's Test Client > and checking for status_code and template used to render the response in

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
Sorry for the bother but I finally solved it by using Django's Test Client and checking for status_code and template used to render the response in my unit-test. Regards, Test Bot On Sat, Mar 30, 2019 at 5:00 PM Test Bot wrote: > I tried removing the {% csrf_token %} from my index.html But it s

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
I tried removing the {% csrf_token %} from my index.html But it seemed to have no effect. I got the following traceback for further clarity * START OF TRACEBACK*

Re: Unit-Testing Django Views

2019-03-30 Thread Test Bot
Thanks everyone for the clearance of the problem. I will remove the unit test's logic to check fir template, it seems a viable test case along with the status code value. On Fri, Mar 29, 2019, 2:24 AM Chetan Ganji wrote: > There is one more way you could do it > > > class TestIndexPageLoad(TestC

Re: Unit-Testing Django Views

2019-03-28 Thread Chetan Ganji
There is one more way you could do it class TestIndexPageLoad(TestCase): def setUp(self): self.client = Client() self.response = self.client.get('/') def test_check_response(self): self.assertTemplateUsed(self.response, 'index.html') Regards, Chetan Ganji +91-900-483-4183 ganji.che...@gmail.

Re: Unit-Testing Django Views

2019-03-28 Thread Chetan Ganji
I would prefer to just check the status code of the response object. This is what I have done. You have to check if it works for forms with csrf_token or not. class TestReverseUrls(TestCase): def setUp(self): self.client = Client() self.reverseUrls = ['index', 'login', 'register'] self.response

Re: Unit-Testing Django Views

2019-03-28 Thread Aldian Fazrihady
There are several things you can try: 1. Mocking csrf token functions 2. Passing the csrf token context from first HTML generation to the second HTML generation 3. Wiping out the csrf token parts from both HTML before comparing them. On Thu, 28 Mar 2019, 23:54 Simon Charette, wrote: > This is ef

Re: Unit-Testing Django Views

2019-03-28 Thread Simon Charette
This is effectively failing because of a mechanism added in 1.10 to protect against BREACH attacks[0] by salting the CSRF token. I'm not aware of any way to disable this mechanism but testing against the exact HTML returned from a view seems fragile. I suggest you use assertContains[1] (with or w

Unit-Testing Django Views

2019-03-28 Thread OnlineJudge95
Hi people, I am following the book Test-Driven Development with Python by *Harry J.W. Perceval.* The book is using Django version 1.7 which is outdated as of now so I started with version 2.1. I am trying

Definitive (or any) guide to testing Django admin actions with intermediate pages?

2018-05-28 Thread Derek
Looking for some help with a persistent problem. While there are many examples scattered across the internet about how to incorporate intermediate pages (typically with a form involved) into a custom Django admin action, I have not been able to find a complete and definitive guide to how to create

Testing Django Admin with Selenium

2017-04-16 Thread Derek
Python 3.5; Django 1.10.7 I am struggling to get access to the admin pages via Selenium. I assume the issue is with the user login not being set properly - I don't want to go via the login page/form every time, so was attempting the session approach. Below is the code that shows the problem. Th

Re: testing django migrations

2015-12-27 Thread Gergely Polonkai
I'm also interested in that, except that I'd like to test RunPython steps. On Dec 28, 2015 12:32 AM, "Dan Tagg" wrote: > Hi, > > I used this: > https://github.com/plumdog/django_migration_testcase > > It's only worth writing tests if you are modifying code created by > makemigrations. > > Dan > >

Re: testing django migrations

2015-12-27 Thread Dan Tagg
Hi, I used this: https://github.com/plumdog/django_migration_testcase It's only worth writing tests if you are modifying code created by makemigrations. Dan On 27 December 2015 at 10:14, varun naganathan wrote: > Hi,I wanted to know how am i supposed to test the working of django > migrations

testing django migrations

2015-12-27 Thread varun naganathan
Hi,I wanted to know how am i supposed to test the working of django migrations.As in how the migrations generate the SQL query.Basically I want to inspect how the sql query generated as in the output of "./manage.py sqlmigrate" is being generated.I've generally used "pdb" along wth unittest.Tes

Re: Testing Django: testing template at different time

2015-03-18 Thread Zaki Akhmad
On Fri, Mar 13, 2015 at 5:32 AM, Collin Anderson wrote: > Hi, > > You could try using freezegun to run the test as if it were a certain time > of day. > https://pypi.python.org/pypi/freezegun Hi Collin, thanks for the response. After spent some time, finally I managed to get the testing. I put

Re: Testing Django: testing template at different time

2015-03-12 Thread Collin Anderson
Hi, You could try using freezegun to run the test as if it were a certain time of day. https://pypi.python.org/pypi/freezegun Or, you could say something like: if 9 <= datetime.datetime.now().hour < 17: self.assertContains(response, "It's working time!") else: self.assertContains(respon

Testing Django: testing template at different time

2015-03-11 Thread Zaki Akhmad
Hello, I'd like to write a test script for my django app. Example, if within business hour, my django app will render: "It's working time!" And if not within business hour, my django app will render: "Happy holiday!" So the views, will check when the url is accessed. How do I write the test sc

Re: wxMailServer: GUI tool to help you with testing Django e-mails

2013-12-19 Thread Donald Casson
Should be gui driven approach. :) On 20 Dec 2013, at 12:48 pm, Donald Casson wrote: > Hi, > > While not as flash as a the guy driven approach. You can use a simple python > one liner to setup a test mail server that will display emails to the > console. > > sudo python -m smtpd -n -c Deb

Re: wxMailServer: GUI tool to help you with testing Django e-mails

2013-12-19 Thread Donald Casson
Hi, While not as flash as a the guy driven approach. You can use a simple python one liner to setup a test mail server that will display emails to the console. sudo python -m smtpd -n -c DebuggingServer localhost:25 Cheers Don On 20 Dec 2013, at 6:57 am, Arnold Krille wrote: > Hi > > On

Re: wxMailServer: GUI tool to help you with testing Django e-mails

2013-12-19 Thread Arnold Krille
Hi On Thu, 19 Dec 2013 01:23:58 -0800 (PST) Michał Pasternak wrote: > I would like to announce a GUI app, written in wxPython, that I > quickly assembled yesterday mainly using some code from StackOverflow > and Google. > > The app is called wxMailServer and all it does is: it acts as a mail > s

wxMailServer: GUI tool to help you with testing Django e-mails

2013-12-19 Thread Michał Pasternak
Hi, I would like to announce a GUI app, written in wxPython, that I quickly assembled yesterday mainly using some code from StackOverflow and Google. The app is called wxMailServer and all it does is: it acts as a mail server (it listens for traffic incoming at localhost port 25) and when an e-

Testing Django Class-based views

2013-10-05 Thread hjwp
I started a discussion about testing class-based (generic) views, a couple of people have pitched in already, thought I'd throw this out there in case anyone else can help: http://www.obeythetestinggoat.com/testing-django-class-based-generic-views-None.html It covers a couple of s

Re: Testing django views: RequestFactory and CSRF protection

2013-07-20 Thread Vladimir Ignatev
Well, looks like I've found workaround. At first we should test if a view have CSRF protection: def test_csrf_protected(self): request = RequestFactory().post('', data={}) response = views.register_form(request) self.assertEqual(response.status_code, 403) (fix me, it is v

Testing django views: RequestFactory and CSRF protection

2013-07-18 Thread Vladimir Ignatev
I need using RequestFactory instead of Client to test one of my views. So the question is how to generate proper CSRF token to provide it to my @csrf_protect'ed view? At this moment I get 403 error when generating POST request. I've read similar topic in this group dated 2011 year, but that top

Re: Problem with testing Django sources

2013-03-11 Thread C. Kirby
ch in this case would be the time the test database thinks it is vs the time the request/response thinks it is vs the time python thinks it is. Chaim On Saturday, March 9, 2013 3:16:22 PM UTC-6, VVilku wrote: > > Hello, > I have problem with testing Django sources from Git.

Problem with testing Django sources

2013-03-09 Thread VVilku
Hello, I have problem with testing Django sources from Git. When I use: * PYTHONPATH=.. /python runtests.py --settings=test_sqlite*(in Windows with Git Shell). I receive these errors: == FAIL: test_naturalday_uses_localtime

Problem with testing Django files (sources).

2013-03-09 Thread Paweł Więc
Hello, I have little problem with testing Django sources in Windows. I have fresh sources from "git clone". I used Git shell (sh.exe) from "Git Bash". When: *PYTHONPATH=.. /python.exe runtests.py --settings=test_sqlite* I

Testing django 1.5 (trunk) with firebirdsql

2012-09-12 Thread maxi
Hi, I'm testing Django 1.5 from trunk against FirebirdSQL 2.5 on Ubuntu 11.04 with Python 2.7 I'm working right now on a new django-firebird [1] backend which do use the new python firebird driver (fdb) [2]. Then, I'm running the django test suite and I get an error when it

Re: testing django applications

2010-11-18 Thread roberto
What if you add a __init__.py inside AAA directory and in your abc/ tests.py you include "from projectXXX.AAA.xyz import class_to_test" plus all the test code you want for testing it ? Good luck! Roberto On Nov 18, 12:05 pm, girish shabadimath wrote: > I will try out that ,, > > > > > > > > > >

Re: testing django applications

2010-11-18 Thread girish shabadimath
I will try out that ,, On Thu, Nov 18, 2010 at 6:47 PM, xvga wrote: > I guess one way would be to put xyz.py in own app. Remember though to > have models.py(empty is fine too) in the app dir > > On Nov 18, 2:27 pm, girish shabadimath > wrote: > > Thanks for the reply, > > but according to the

Re: testing django applications

2010-11-18 Thread xvga
I guess one way would be to put xyz.py in own app. Remember though to have models.py(empty is fine too) in the app dir On Nov 18, 2:27 pm, girish shabadimath wrote: > Thanks for the reply, > but according to the django > documentationhttp://docs.djangoproject.com/en/1.2/topics/testing/#writing-

Re: testing django applications

2010-11-18 Thread girish shabadimath
Thanks for the reply, but according to the django documentation http://docs.djangoproject.com/en/1.2/topics/testing/#writing-unit-tests test runner looks for tests only in models.py or tests.py of a specific application,,but

Re: testing django applications

2010-11-18 Thread xvga
Hi Girish, why don't you put tests.py in the same dir where xyz.py is? On Nov 18, 11:52 am, girish shabadimath wrote: > Hi all, > > im working on a django project XXX, > > the directory structure is as follows: > > - project XXX >       -abc >          models.py >          views.py >          t

testing django applications

2010-11-18 Thread girish shabadimath
Hi all, im working on a django project XXX, the directory structure is as follows: - project XXX -abc models.py views.py tests.py urls.py +docs +libs +logs +thirdparty +corns - AAA xyz.py aaa.py setti

Re: Testing Django applications

2009-12-15 Thread Jonas Obrist
HB wrote: > Hey, > Grails framework offers a huge set of tools to facilitate testing > (unit and integration) > I heard the same thing is true for Rails > Does Django offers the same thing? > Thanks. > > -- > > You received this message because you are subscribed to the Google Groups > "Django use

Testing Django applications

2009-12-15 Thread HB
Hey, Grails framework offers a huge set of tools to facilitate testing (unit and integration) I heard the same thing is true for Rails Does Django offers the same thing? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: any ideas about "load testing" django apps?

2009-07-08 Thread Alex Gaynor
On Wed, Jul 8, 2009 at 3:52 PM, happyb787 wrote: > > Any ideas about load testing django apps? JMeter? Ab? > > Please advise. thanks! > > > > You'd use the same tools you use for any other HTTP application, I've heard good things about Ab and Siege. Alex

any ideas about "load testing" django apps?

2009-07-08 Thread happyb787
Any ideas about load testing django apps? JMeter? Ab? Please advise. thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Testing Django Templates

2009-06-08 Thread Andrew Fong
I'm trying to get into a better testing flow with Django. One of things I'm trying to figure out how to test are templates. Using the Django Test Client works fine, for instance, in detecting whether I have a missing template tag (because it'll explode) or if I don't pass a particular variable to

Re: Testing Django and HTTP Request

2009-02-09 Thread Vitaly Babiy
Hey Alex I got cherrypy to work great I am going to post a blog as soon as my blog is done :) If anyone cares just ask here and I will post a write up here. Vitaly Babiy On Mon, Feb 9, 2009 at 7:52 AM, Vitaly Babiy wrote: > Thank you Alex for you help I will look in to this. > > Vitaly Babiy >

Re: Testing Django and HTTP Request

2009-02-09 Thread Vitaly Babiy
Thank you Alex for you help I will look in to this. Vitaly Babiy On Mon, Feb 9, 2009 at 12:32 AM, Alex Gaynor wrote: > > > On Mon, Feb 9, 2009 at 12:28 AM, Vitaly Babiy wrote: > >> Yeah, it does. I am going to have to look to see if can find a better >> stand alone server to do this instead o

Re: Testing Django and HTTP Request

2009-02-08 Thread Alex Gaynor
On Mon, Feb 9, 2009 at 12:28 AM, Vitaly Babiy wrote: > Yeah, it does. I am going to have to look to see if can find a better stand > alone server to do this instead of patching django. > > Vitaly Babiy > > > On Mon, Feb 9, 2009 at 12:22 AM, Alex Gaynor wrote: > >> >> >> On Mon, Feb 9, 2009 at 12:

Re: Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Yeah, it does. I am going to have to look to see if can find a better stand alone server to do this instead of patching django. Vitaly Babiy On Mon, Feb 9, 2009 at 12:22 AM, Alex Gaynor wrote: > > > On Mon, Feb 9, 2009 at 12:18 AM, Vitaly Babiy wrote: > >> Yea, but I see a few problems whit t

Re: Testing Django and HTTP Request

2009-02-08 Thread Alex Gaynor
On Mon, Feb 9, 2009 at 12:18 AM, Vitaly Babiy wrote: > Yea, but I see a few problems whit that solution: > >- Hacky >- Still not guaranteed to work( it could take more time) >- Would really slow down the tests > > Vitaly Babiy > > > On Mon, Feb 9, 2009 at 12:15 AM, Alex Gaynor wrote:

Re: Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Yea, but I see a few problems whit that solution: - Hacky - Still not guaranteed to work( it could take more time) - Would really slow down the tests Vitaly Babiy On Mon, Feb 9, 2009 at 12:15 AM, Alex Gaynor wrote: > > > On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy wrote: > >> Righ

Re: Testing Django and HTTP Request

2009-02-08 Thread Alex Gaynor
On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy wrote: > Right the problem is if I reload the server on ever test, there is not > enough time for the thread to kill the server. So when the next setUp comes > around the port is still in use. > I think I need to find a way to start a HTTP server at t

Re: Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Right the problem is if I reload the server on ever test, there is not enough time for the thread to kill the server. So when the next setUp comes around the port is still in use. I think I need to find a way to start a HTTP server at the beginning of the test and keep it around till all test are d

Re: Testing Django and HTTP Request

2009-02-08 Thread Alex Gaynor
On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy wrote: > Hello everyone, > > I am working on a project that will need to make a request out to the web > and pull down some data, For testing purpose I was wonder what would be the > best way to test this. I don't want to make the actual request durin

Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Hello everyone, I am working on a project that will need to make a request out to the web and pull down some data, For testing purpose I was wonder what would be the best way to test this. I don't want to make the actual request during the test, because for one if I am off-line all those tests wil

Re: Questions related to testing Django application using Sqlite

2008-02-07 Thread Manoj Govindan
Hi Jacob, > > Under Sqlite tests run in an in-memory database, so this is perfectly > normal. Like you, I see about a 10x speedup running tests against > Sqlite. > Not surprisingly the tests slowed down once I added the TEST_DATABASE_NAME parameter to settings. It made debugging easier though.

Re: Questions related to testing Django application using Sqlite

2008-02-05 Thread Jacob Kaplan-Moss
On 2/5/08, Manoj Govindan <[EMAIL PROTECTED]> wrote: > Recently I tried using Sqlite instead of Postgres as the database > engine for testing one of my django applications. > My observations follow: > > 1) Tests ran significantly faster[1]. Under Sqlite tests run in an in-memory database, so this

Questions related to testing Django application using Sqlite

2008-02-04 Thread Manoj Govindan
Recently I tried using Sqlite instead of Postgres as the database engine for testing one of my django applications. My observations follow: 1) Tests ran significantly faster[1]. 2) Some tests failed in Windows while some of them failed in both Windows and Linux. All tests succeeded in both operat

Re: Testing Django App Running on Dev Server with Selenium

2007-03-11 Thread Paul Childs
Thanks for the suggestion Grig. I'll give it a shot on Monday. /Paul On 3/10/07, Grig <[EMAIL PROTECTED]> wrote: > > Paul -- have you tried running the Selenium RC server non- > interactively, then interacting with it via one of the languages it > supports? Python for example, since you're doing

Re: Testing Django App Running on Dev Server with Selenium

2007-03-10 Thread Grig
Paul -- have you tried running the Selenium RC server non- interactively, then interacting with it via one of the languages it supports? Python for example, since you're doing Django development. Look in the python sub-directory of the selenium-rc distribution, and modify the test_google.py script

Re: Testing Django App Running on Dev Server with Selenium

2007-03-09 Thread Paul Childs
Thanks Jeremy. > I think, since the idms pattern is not being handled by an include, > you may want this: > (r'^idms/$',"idms.general.views.idms" ), > (note the "$" at the end of the pattern). I made the change and tried again but it didn't make a difference. Cheers, /Paul --~--~-~--~

Re: Testing Django App Running on Dev Server with Selenium

2007-03-09 Thread Jeremy Dunck
On 3/9/07, Paul Childs <[EMAIL PROTECTED]> wrote: ... > (r'^ssi/', include('idms.ssi.urls')), > > (r'^idms/',"idms.general.views.idms" ), > I think, since the idms pattern is not being handled by an include, you may want this: (r'^idms/$',"idms.general.views.idms" ), (note the "$" at the

Re: Testing Django App Running on Dev Server with Selenium

2007-03-09 Thread Malcolm Tredinnick
On Fri, 2007-03-09 at 13:57 +, Paul Childs wrote: > Thanks again Malcolm. > > It looks like this is starting to get beyond my comfort level. Given > that and my time constraints, it looks like Selenium is a non-starter. > I guess I'll just have to rely on humans to do that part of the > testi

Re: Testing Django App Running on Dev Server with Selenium

2007-03-09 Thread Paul Childs
Thanks again Malcolm. It looks like this is starting to get beyond my comfort level. Given that and my time constraints, it looks like Selenium is a non-starter. I guess I'll just have to rely on humans to do that part of the testing. The Selenium IDE worked fine but unfortunately it's not possib

Re: Testing Django App Running on Dev Server with Selenium

2007-03-09 Thread Malcolm Tredinnick
On Fri, 2007-03-09 at 12:59 +, Paul Childs wrote: > Thanks for the response Malcom... > > > Does the same URL work if you aren't using Selenium? I'm trying to trim > > down the problem to something smaller. > When I type http://127.0.0.1:8000/idms/ into the address bar I do not > get a Django

Re: Testing Django App Running on Dev Server with Selenium

2007-03-09 Thread Paul Childs
Thanks for the response Malcom... > Does the same URL work if you aren't using Selenium? I'm trying to trim > down the problem to something smaller. When I type http://127.0.0.1:8000/idms/ into the address bar I do not get a Django error and the proper page is rendered. > I *suspect* there is a

Re: Testing Django App Running on Dev Server with Selenium

2007-03-08 Thread Malcolm Tredinnick
On Thu, 2007-03-08 at 19:46 +, Paul Childs wrote: [...] > Then I get this Django Error message in the browser... > > TypeError at http://127.0.0.1:8000/idms/ > unpack non-sequence > Request Method: GET > Request URL: http://127.0.0.1:8000http://127.0.0.1:8000/idms/ < > THIS IS INTERESTI

Testing Django App Running on Dev Server with Selenium

2007-03-08 Thread Paul Childs
I have Selenium RC running and I was wondering if someone might be able to nudge me in the right direction. I am trying to at least get my local web site, running on the Django dev server, to display in the browser without an error, nothing more. Any help would be appreciated. The following are t

testing django: cookies and twill

2007-01-19 Thread mthorley
Maybe I'm just totally dumb--In fact I'm pretty convinced that's the problem here. I'm trying to test django with twill, but django doesn't appear to be sending any cookies. When I view the site in firefox the cookies are there, when I try it with twill I don't see any cookies. Can some one pleas