Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
03ddd086
Commit
03ddd086
authored
Aug 06, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add flagging test to notifications
parent
14e78165
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
10 deletions
+34
-10
config/mongoid.yml
+1
-9
spec/api/notifications_spec.rb
+33
-1
No files found.
config/mongoid.yml
View file @
03ddd086
development
2
:
development
:
sessions
:
default
:
database
:
cs_comments_service_development
hosts
:
-
localhost:27017
development
:
sessions
:
default
:
database
:
comments-prod-clone
hosts
:
-
charlotte.mongohq.com:10035
username
:
kevinchugh@edx.org
password
:
lewis123
test
:
sessions
:
default
:
...
...
spec/api/notifications_spec.rb
View file @
03ddd086
...
...
@@ -42,7 +42,6 @@ describe "app" do
end
end
#now make sure the threads are a subset of the user's subscriptions
puts
user
.
id
subscriptions
=
Subscription
.
where
(
:subscriber_id
=>
user
.
id
.
to_s
)
subscribed_thread_ids
=
subscriptions
.
collect
{
|
s
|
s
.
source_id
}
...
...
@@ -50,6 +49,39 @@ describe "app" do
end
it
"returns only unflagged threads"
do
start_time
=
Date
.
today
-
400
.
days
end_time
=
Time
.
now
user
=
User
.
find
Subscription
.
first
.
subscriber_id
post
"/api/v1/notifications"
,
from:
CGI
::
escape
(
start_time
.
to_s
),
to:
CGI
::
escape
(
end_time
.
to_s
),
user_ids:
user
.
id
last_response
.
should
be_ok
payload
=
JSON
.
parse
last_response
.
body
courses
=
payload
[
user
.
id
.
to_s
]
thread_ids
=
[]
courses
.
each
do
|
k
,
v
|
v
.
each
do
|
kk
,
vv
|
thread_ids
<<
kk
end
end
#now flag the first thread
thread
=
CommentThread
.
find
thread_ids
.
first
thread
.
historical_abuse_flaggers
<<
[
"1"
]
post
"/api/v1/notifications"
,
from:
CGI
::
escape
(
start_time
.
to_s
),
to:
CGI
::
escape
(
end_time
.
to_s
),
user_ids:
user
.
id
last_response
.
should
be_ok
payload
=
JSON
.
parse
last_response
.
body
courses
=
payload
[
user
.
id
.
to_s
]
new_thread_ids
=
[]
courses
.
each
do
|
k
,
v
|
v
.
each
do
|
kk
,
vv
|
new_thread_ids
<<
kk
end
end
(
new_thread_ids
.
include?
thread
.
id
).
should
==
false
end
end
end
end
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