django-tests

When in run test cases then I will get this error: psycopg2.OperationalError: cursor “_django_curs_140351416325888_23” does not exist

﹥>﹥吖頭↗ 提交于 2019-12-08 15:07:11
问题 I'm tring to run test cases I got below error. Run commond : python manage.py test Type 'yes' if you would like to try deleting the test database 'test_project_management_db', or 'no' to cancel: yes Destroying old test database for alias 'default'... Traceback (most recent call last): File "manage.py", line 24, in <module> execute_from_command_line(sys.argv) File "/home/rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line

django update_or_create gets “duplicate key value violates unique constraint ”

社会主义新天地 提交于 2019-12-07 05:30:22
问题 Maybe I misunderstand the purpose of Django's update_or_create Model method. Here is my Model: from django.db import models import datetime from vc.models import Cluster class Vmt(models.Model): added = models.DateField(default=datetime.date.today, blank=True, null=True) creation_time = models.TextField(blank=True, null=True) current_pm_active = models.TextField(blank=True, null=True) current_pm_total = models.TextField(blank=True, null=True) ... more simple fields ... cluster = models

django update_or_create gets “duplicate key value violates unique constraint ”

限于喜欢 提交于 2019-12-05 09:31:59
Maybe I misunderstand the purpose of Django's update_or_create Model method. Here is my Model: from django.db import models import datetime from vc.models import Cluster class Vmt(models.Model): added = models.DateField(default=datetime.date.today, blank=True, null=True) creation_time = models.TextField(blank=True, null=True) current_pm_active = models.TextField(blank=True, null=True) current_pm_total = models.TextField(blank=True, null=True) ... more simple fields ... cluster = models.ForeignKey(Cluster, null=True) class Meta: unique_together = (("cluster", "added"),) Here is my test: from

Django 2.1 Test Issue

前提是你 提交于 2019-12-04 06:43:44
问题 first of all thank you for your time and sorry about my english. Im learning Django, I had several years developing with python and decided to start to check this Framework. And I'm getting an weird responses. Im writting a TestCase, wich works perfectly outside Test. That is the code: class BoardTopicsTests(TestCase): # Hago las acciones necesarias para empezar el test def setUp(self): self.board = Board(name="Django", description="Django board.") # self.board.save() # Compruebo el status

Django 2.1 Test Issue

随声附和 提交于 2019-12-02 10:43:15
first of all thank you for your time and sorry about my english. Im learning Django, I had several years developing with python and decided to start to check this Framework. And I'm getting an weird responses. Im writting a TestCase, wich works perfectly outside Test. That is the code: class BoardTopicsTests(TestCase): # Hago las acciones necesarias para empezar el test def setUp(self): self.board = Board(name="Django", description="Django board.") # self.board.save() # Compruebo el status_code 200 def test_board_topics_view_status_code(self): # self.board.save() url = reverse("board_topics",

TypeError when concatenating django.test.LiveServerTestCase's live_server_url with another string

試著忘記壹切 提交于 2019-12-01 23:47:36
Whenever I try to construct a string based on self.live_server_url , I get python TypeError messages. For example, I've tried the following string constructions (form 1 & 2 below), but I experience the same TypeError . My desired string is the Live Server URL with "/lists" appended. NOTE: the actual test does succeed to create a server and I can manually access the server, and more specifically, I can manually access the exact URL that I'm trying to build programmatically (e.g. 'http://localhost:8081/lists '). TypeError s occur with these string constructions. # FORM 1 lists_live_server_url =