Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bryan BRANCOTTE
django-basetheme-bootstrap
Commits
a9ad5ff9
Commit
a9ad5ff9
authored
Mar 27, 2019
by
Bryan BRANCOTTE
Browse files
more tests
parent
74162333
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
a9ad5ff9
...
...
@@ -6,4 +6,5 @@ venv
.DS_Store
db.sqlite3
*.mo
.idea
\ No newline at end of file
.idea
.coverage
\ No newline at end of file
basetheme_bootstrap/tests.py
View file @
a9ad5ff9
...
...
@@ -2,7 +2,7 @@ from django.conf import settings
from
django.contrib.auth
import
get_user_model
from
django.core.cache
import
cache
from
django.core.exceptions
import
ValidationError
from
django.test
import
TestCase
,
RequestFactory
from
django.test
import
TestCase
,
RequestFactory
,
override_settings
from
django.urls
import
reverse
from
basetheme_bootstrap
import
user_preferences
...
...
@@ -16,6 +16,9 @@ class AboutPageTests(TestCase):
class
SignUpTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
def
test_works
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'basetheme_bootstrap:signup'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -36,6 +39,9 @@ class SignUpTests(TestCase):
class
SuperuserSignUpTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
def
test_sign_up_for_superuser
(
self
):
response
=
self
.
client
.
post
(
reverse
(
'basetheme_bootstrap:signup'
),
{
'username'
:
"userAAA"
,
...
...
@@ -64,6 +70,7 @@ class SuperuserSignUpTests(TestCase):
class
ChangePasswordTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
self
.
user_pwd
=
"eil2guj4cuSho2Vai3hu"
self
.
user_pwd_2
=
"aig7thah4eethahdaDae"
self
.
user
=
get_user_model
().
objects
.
create
(
...
...
@@ -116,6 +123,7 @@ class ChangePasswordTests(TestCase):
class
ChangeFirstnameTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
self
.
user_pwd
=
"eil2guj4cuSho2Vai3hu"
self
.
user_pwd_2
=
"aig7thah4eethahdaDae"
self
.
user
=
get_user_model
().
objects
.
create
(
...
...
@@ -160,6 +168,7 @@ class ChangeFirstnameTests(TestCase):
class
DeleteAccountTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
self
.
user_pwd
=
"eil2guj4cuSho2Vai3hu"
self
.
user_pwd_2
=
"aig7thah4eethahdaDae"
self
.
user
=
get_user_model
().
objects
.
create
(
...
...
@@ -185,6 +194,7 @@ class DeleteAccountTests(TestCase):
class
TemplatesTagsTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
self
.
factory
=
RequestFactory
()
def
test_is_active_or_desc
(
self
):
...
...
@@ -247,6 +257,7 @@ class TemplatesTagsTests(TestCase):
class
UserPreferencesTests
(
TestCase
):
def
setUp
(
self
):
cache
.
clear
()
self
.
user_pwd
=
"eil2guj4cuSho2Vai3hu"
self
.
user
=
get_user_model
().
objects
.
create
(
username
=
"user"
,
...
...
@@ -280,6 +291,7 @@ class UserPreferencesTests(TestCase):
default_pref
.
user
=
None
default_pref
.
save
()
pref
.
save
()
str
(
pref
)
default_pref
=
user_preferences
.
get_user_preferences_for_user
(
None
)
self
.
assertIsNotNone
(
default_pref
)
...
...
@@ -300,3 +312,29 @@ class UserPreferencesTests(TestCase):
cache
.
get
(
"has_no_user_preferences_model"
,
False
)
or
getattr
(
settings
,
"BASETHEME_BOOTSTRAP_USER_PREFERENCE_MODEL_ENABLED"
,
False
)
)
@
override_settings
(
BASETHEME_BOOTSTRAP_USER_PREFERENCE_MODEL_ENABLED
=
False
,
)
class
SignUpTestsUserPrefDown
(
SignUpTests
):
pass
def
test_dummy
(
self
):
self
.
client
.
post
(
reverse
(
'basetheme_bootstrap:signup'
),
{
'username'
:
"userAAA"
,
'email'
:
"userAAA@mp.com"
,
'password1'
:
"user@mp.comuser@mp.comuser@mp.comuser@mp.com"
,
'password2'
:
"user@mp.comuser@mp.comuser@mp.comuser@mp.com"
,
'first_name'
:
"user"
})
user_preferences
.
get_user_preference_class
()
user_preferences
.
get_user_preference_class
()
user_preferences
.
get_user_preferences_for_user
(
get_user_model
().
objects
.
first
())
@
override_settings
(
BASETHEME_BOOTSTRAP_USER_PREFERENCE_MODEL_NAME
=
"AAAAA"
,
)
class
SignUpTestsUserWrongUserPrefLocation
(
SignUpTests
):
pass
setup.py
View file @
a9ad5ff9
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
glob
from
setuptools
import
setup
readme
=
open
(
'README.rst'
).
read
()
...
...
@@ -18,5 +17,6 @@ setup(
'django'
,
'django-crispy-forms'
],
license
=
"BSD"
license
=
"BSD"
,
test_suite
=
"runtests.run_all_tests"
,
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment