Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
campaign
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
bb148de0
Commit
bb148de0
authored
Jan 05, 2017
by
okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Organization models and view covered at 100%
parent
c1cb576f
Pipeline
#715
passed with stage
in 1 minute and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
5 deletions
+75
-5
picampaign/feedback/views.py
picampaign/feedback/views.py
+1
-5
picampaign/organization/tests.py
picampaign/organization/tests.py
+74
-0
No files found.
picampaign/feedback/views.py
View file @
bb148de0
...
...
@@ -13,10 +13,6 @@ class FeedbackViewSet(viewsets.ViewSet):
def
create
(
self
,
request
,
campaign_pk
=
None
):
serializer
=
FeedbackSerializer
(
data
=
request
.
data
)
try
:
serializer
.
is_valid
()
except
Exception
as
e
:
print
(
"Bloup"
)
raise
e
serializer
.
is_valid
()
feedback
=
Feedback
.
objects
.
create
(
**
serializer
.
validated_data
)
return
Response
(
feedback
.
id
)
picampaign/organization/tests.py
View file @
bb148de0
from
django.test
import
TestCase
from
rest_framework.test
import
APIClient
from
picampaign.organization.models
import
Organization
,
GroupType
,
Group
,
FeedbackCategory
from
picampaign.campaign.models
import
Campaign
# Create your tests here.
class
OrganizationTest
(
TestCase
):
def
test_str
(
self
):
organization
=
Organization
.
objects
.
create
(
name
=
'Majestic 12'
,
sip_key
=
'majestic-12'
)
self
.
assertEqual
(
str
(
organization
),
organization
.
name
)
class
GroupTypeTest
(
TestCase
):
def
test_str
(
self
):
organization
=
Organization
.
objects
.
create
(
name
=
'Majestic 12'
,
sip_key
=
'majestic-12'
)
grouptype
=
GroupType
.
objects
.
create
(
name
=
'comittee'
,
organization
=
organization
)
self
.
assertEqual
(
str
(
grouptype
),
grouptype
.
name
)
class
GroupTest
(
TestCase
):
def
test_str
(
self
):
organization
=
Organization
.
objects
.
create
(
name
=
'Majestic 12'
,
sip_key
=
'majestic-12'
)
grouptype
=
GroupType
.
objects
.
create
(
name
=
'comittee'
,
organization
=
organization
)
group
=
Group
.
objects
.
create
(
name
=
'group'
,
type
=
grouptype
)
self
.
assertEqual
(
str
(
group
),
group
.
name
)
class
FeedbackCategoryTest
(
TestCase
):
def
test_str
(
self
):
organization
=
Organization
.
objects
.
create
(
name
=
'Majestic 12'
,
sip_key
=
'majestic-12'
)
feedbackcategory
=
FeedbackCategory
.
objects
.
create
(
name
=
'Feedback'
,
organization
=
organization
)
self
.
assertEqual
(
str
(
feedbackcategory
),
feedbackcategory
.
name
)
class
CategoryViewSet
(
TestCase
):
def
setUp
(
self
):
self
.
organization
=
Organization
.
objects
.
create
(
name
=
'Majestic 12'
,
sip_key
=
'majestic-12'
)
self
.
campaign
=
Campaign
.
objects
.
create
(
title
=
'Test Campaign'
,
start_date
=
'2000-01-01'
,
end_date
=
'2100-12-31'
,
organization
=
self
.
organization
)
self
.
feedbackcategory
=
FeedbackCategory
.
objects
.
create
(
name
=
'Feedback'
,
organization
=
self
.
organization
)
def
test_feedbackcategory_viewset
(
self
):
client
=
APIClient
()
response
=
client
.
get
(
'/campaigns/%(cid)s/categories/'
%
{
'cid'
:
self
.
campaign
.
id
},
format
=
'json'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
content
,
b
'[{"id":1,"name":"Feedback"}]'
)
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