42
loading...
This website collects cookies to deliver better user experience
python manage.py test polls
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
F
======================================================================
FAIL: test_was_published_recently_with_future_question (polls.tests.QuestionModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/path/to/mysite/polls/tests.py", line 16, in test_was_published_recently_with_future_question
self.assertIs(future_question.was_published_recently(), False)
AssertionError: True is not False
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (failures=1)
Destroying test database for alias 'default'...
Creating test database for alias 'default'...
Failed (ORA-01543: tablespace 'TEST_SYSTEM' already exists)
It appears the test database, test_system, already exists. Type 'yes' to delete it, or 'no' to cancel: yes
Destroying old test database for alias 'default'...
Creating test user...
Failed (ORA-65096: invalid common user or role name)
Got an error creating the test user: ORA-65096: invalid common user or role name
SQL> show con_name
CON_NAME
-----------------------------------
CDB$ROOT
99.9% of the time the error ORA-65096: invalid common user or role name means you are logged into the CDB when you should be logged into a PDB.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
--------------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 XEPDB1 READ WRITE NO
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'mydatabase',
'USER': 'mydatabaseuser',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '1521',
}
}
PS D:\Workplace\Backend\mysite> sqlplus django/django
SQL*Plus: Release 18.0.0.0.0 - Production on Wed Jul 28 15:56:57 2021
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
ORA-01920: user name 'DJANGO' conflicts with another user or role name
You are connecting to root container by using sqlplus testtest/password where the user doesn't exist.
Instead, you can use EZConnect or you can create a TNS name to connect to the PDB.
PS D:\Workplace\Backend\mysite> sqlplus django/django@localhost:1521/XEPDB1
SQL*Plus: Release 18.0.0.0.0 - Production on Wed Jul 28 16:05:09 2021
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Last Successful login time: Wed Jul 28 2021 14:18:57 +07:00
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL>
SQL> create user test identified by test;
User created.
The HOST and PORT keys need to be left out of the dictionary - else Django will try connecting with the complete "NAME" as an SID.
PS D:\Workplace\Backend\mysite> sqlplus -L "django/django@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XEPDB1)))"
SQL*Plus: Release 18.0.0.0.0 - Production on Wed Jul 28 12:06:33 2021
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Last Successful login time: Wed Jul 28 2021 12:02:04 +07:00
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'localhost:1521/XEPDB1',
'USER': 'django',
'PASSWORD': 'django',
}
}
PS D:\Workplace\Backend\mysite> sqlplus "sys AS SYSDBA"
SQL*Plus: Release 18.0.0.0.0 - Production on Wed Jul 28 12:47:31 2021
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL> alter session set container = XEPDB1;
Session altered.
SQL> create user django identified by django;
User created.
SQL> grant all privileges to django;
Grant succeeded.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'localhost:1521/XEPDB1',
'USER': 'django',
'PASSWORD': 'django',
}
}
python manage.py migrate
PS D:\Workplace\Backend\mysite> python manage.py test polls
Creating test database for alias 'default'...
Creating test user...
System check identified no issues (0 silenced).
F
======================================================================
FAIL: test_was_published_recently_with_future_question (polls.tests.QuestionModelTests)
---------------------------------------------------------------------------
Traceback (most recent call last):
File "D:\Workplace\Backend\mysite\polls\tests.py", line 12, in test_was_published_recently_with_future_question
self.assertIs(future_question.was_published_recently(), False)
AssertionError: True is not False
---------------------------------------------------------------------------
Ran 1 test in 0.006s
FAILED (failures=1)
Destroying test database for alias 'default'...
Destroying test user...
Destroying test database tables...