Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Boxiang Sun
gitlab-ce
Commits
5a1f3df3
Commit
5a1f3df3
authored
Jun 22, 2017
by
blackst0ne
Committed by
Douwe Maan
Jul 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove spec/lib/api/helpers/csrf_tokens_spec.rb
parent
cc3a82bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
42 deletions
+0
-42
spec/lib/api/helpers/csrf_tokens_spec.rb
spec/lib/api/helpers/csrf_tokens_spec.rb
+0
-42
No files found.
spec/lib/api/helpers/csrf_tokens_spec.rb
deleted
100644 → 0
View file @
cc3a82bc
require
'spec_helper'
describe
API
::
Helpers
do
subject
do
Class
.
new
.
include
(
described_class
).
new
end
let
(
:header_token
)
{
'WblCcheb1qQLHFVhlMtwOhxJr5613vUT05vCvToRvfJ68UPT7+eV5xpaY9CjubnF3VGbTfIhQYkZWmWTfvZAWQ=='
}
let
(
:session_token
)
{
'I0gBofh8Q0MRRjaxN3LJ/8EYNNNH/7SaysGnLkTn/as='
}
before
do
class
Request
attr_reader
:headers
attr_reader
:session
def
initialize
(
header_token
=
nil
,
session_token
=
nil
)
@headers
=
{
'X-Csrf-Token'
=>
header_token
}
@session
=
{
'_csrf_token'
=>
session_token
}
end
end
end
it
'should return false if header token is invalid'
do
request
=
Request
.
new
(
nil
,
session_token
)
expect
(
subject
.
send
(
:csrf_tokens_valid?
,
request
)).
to
be
false
end
it
'should return false if session_token token is invalid'
do
request
=
Request
.
new
(
header_token
,
nil
)
expect
(
subject
.
send
(
:csrf_tokens_valid?
,
request
)).
to
be
false
end
it
'should return false if header_token is not 64 symbols long'
do
request
=
Request
.
new
(
header_token
[
0
..
16
],
session_token
)
expect
(
subject
.
send
(
:csrf_tokens_valid?
,
request
)).
to
be
false
end
it
'should return true if both header_token and session_token are correct'
do
request
=
Request
.
new
(
header_token
,
session_token
)
expect
(
subject
.
send
(
:csrf_tokens_valid?
,
request
)).
to
be
true
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