django-tests

Assertion error while testing Django views

风流意气都作罢 提交于 2020-04-07 07:17:37
问题 This is my testing function for views.py which I have mention below: def test_operation_page(self): url = reverse('operation') response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'abc.html') self.assertContains(response, '<b>BOOK id having certain title:</b>') This is the error I am having while testing my views AssertionError: Database queries to 'default' are not allowed in SimpleTestCase subclasses. Either subclass TestCase or

Setting liveserver port when running tests in django

强颜欢笑 提交于 2020-01-14 10:32:48
问题 I am using django for a webapp and I'm using docker to deploy it. I need to test it in the container with selenium. I'm using selenium grid for testing. In order to connect with the liveserver on the docker, i need to port forward a specific port, but as far as i read in the django docs, LiveServerTestCase uses port 0, which means random port every time i run the tests. Since --liveserver options is deprecated, is there any other way to set the port of the test server or a smarter way to test

Setting liveserver port when running tests in django

荒凉一梦 提交于 2020-01-14 10:32:37
问题 I am using django for a webapp and I'm using docker to deploy it. I need to test it in the container with selenium. I'm using selenium grid for testing. In order to connect with the liveserver on the docker, i need to port forward a specific port, but as far as i read in the django docs, LiveServerTestCase uses port 0, which means random port every time i run the tests. Since --liveserver options is deprecated, is there any other way to set the port of the test server or a smarter way to test