Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
748adc80
Commit
748adc80
authored
Aug 06, 2016
by
Porkepix
Browse files
Clean test file from every unicode tests as those are now useless with Python 3
parent
1d2b6677
Changes
1
Hide whitespace changes
Inline
Side-by-side
picampaign/campaign/tests.py
View file @
748adc80
from
django.conf
import
settings
from
django.test
import
TestCase
from
picampaign.campaign.models
import
Campaign
,
Argumentary
,
CampaignContact
from
picampaign.campaign.models
import
Campaign
,
CampaignContact
from
picampaign.contact.models
import
Contact
class
CampaignMethodTests
(
TestCase
):
def
test_unicode_is_title
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
)
self
.
assertEqual
(
campaign
.
__unicode__
(),
'Campaign Title'
)
def
test_unicode_is_unicode
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
)
self
.
assertEqual
(
str
(
type
(
campaign
.
__unicode__
())),
"<type 'unicode'>"
)
class
ArgumentaryMethodTests
(
TestCase
):
def
test_unicode_is_title
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
)
argumentary
=
Argumentary
(
campaign
=
campaign
,
lang
=
'en'
)
self
.
assertEqual
(
argumentary
.
__unicode__
(),
"Argumentary in en for Campaign Title"
)
def
test_unicode_is_unicode
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
)
argumentary
=
Argumentary
(
campaign
=
campaign
,
lang
=
'en'
)
self
.
assertEqual
(
str
(
type
(
argumentary
.
__unicode__
())),
"<type 'unicode'>"
)
class
CampaignContactMethodTests
(
TestCase
):
def
test_unicode_is_contact_and_title
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
)
contact
=
Contact
(
first_name
=
'Victor'
,
last_name
=
'Hugo'
,
phone
=
'+3312345678'
)
campaigncontact
=
CampaignContact
(
campaign
=
campaign
,
contact
=
contact
)
self
.
assertEqual
(
campaigncontact
.
__unicode__
(),
"Contact Victor Hugo on Campaign Title"
)
def
test_unicode_is_unicode
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
)
contact
=
Contact
(
first_name
=
'Victor'
,
last_name
=
'Hugo'
,
phone
=
'+3312345678'
)
campaigncontact
=
CampaignContact
(
campaign
=
campaign
,
contact
=
contact
)
self
.
assertEqual
(
str
(
campaigncontact
),
"Contact Contact object on Campaign Title"
)
def
test_all_groups_is_empty
(
self
):
campaign
=
Campaign
(
title
=
'Campaign Title'
,
...
...
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