Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
12cb26f1
Commit
12cb26f1
authored
Oct 11, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test hosting form
parent
45e86d82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
accounts/tests.py
accounts/tests.py
+40
-0
No files found.
accounts/tests.py
View file @
12cb26f1
...
...
@@ -43,6 +43,7 @@ from trans.tests.views import ViewTestCase
from
trans.tests.util
import
get_test_file
from
trans.models.unitdata
import
Suggestion
,
Comment
from
lang.models
import
Language
from
weblate
import
appsettings
REGISTRATION_DATA
=
{
'username'
:
'username'
,
...
...
@@ -230,6 +231,45 @@ class ViewTest(TestCase):
'[Weblate] Message from dark side'
)
def
test_hosting
(
self
):
'''
Test for contact form.
'''
# Hack to allow sending of mails
settings
.
ADMINS
=
((
'Weblate test'
,
'noreply@weblate.org'
),
)
# Disabled hosting
appsettings
.
OFFER_HOSTING
=
False
response
=
self
.
client
.
get
(
reverse
(
'hosting'
))
self
.
assertRedirects
(
response
,
reverse
(
'home'
))
# Enabled
appsettings
.
OFFER_HOSTING
=
True
response
=
self
.
client
.
get
(
reverse
(
'hosting'
))
self
.
assertContains
(
response
,
'class="contact-table"'
)
# Sending message
response
=
self
.
client
.
post
(
reverse
(
'hosting'
),
{
'name'
:
'Test'
,
'email'
:
'noreply@weblate.org'
,
'project'
:
'HOST'
,
'url'
:
'http://example.net'
,
'repo'
:
'git://github.com/nijel/weblate.git'
,
'mask'
:
'po/*.po'
,
'message'
:
'Hi
\
n
\
n
This app looks really cool I want to use it!'
,
}
)
self
.
assertRedirects
(
response
,
reverse
(
'home'
))
# Verify message
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
(
mail
.
outbox
[
0
].
subject
,
'[Weblate] Hosting request for HOST'
)
def
test_contact_subject
(
self
):
# With set subject
response
=
self
.
client
.
get
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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