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
7ba65d05
Commit
7ba65d05
authored
Nov 20, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Bitbucket callback spec
parent
2747e515
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
spec/controllers/import/bitbucket_controller_spec.rb
spec/controllers/import/bitbucket_controller_spec.rb
+14
-6
No files found.
spec/controllers/import/bitbucket_controller_spec.rb
View file @
7ba65d05
...
...
@@ -6,11 +6,11 @@ describe Import::BitbucketController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:token
)
{
"asdasd12345"
}
let
(
:secret
)
{
"sekrettt"
}
let
(
:refresh_token
)
{
SecureRandom
.
hex
(
15
)
}
let
(
:access_params
)
{
{
bitbucket_access_token:
token
,
bitbucket_access_token_secret:
secret
}
}
def
assign_session_tokens
session
[
:bitbucket_access_token
]
=
token
session
[
:bitbucket_access_token_secret
]
=
secret
session
[
:bitbucket_token
]
=
token
end
before
do
...
...
@@ -24,15 +24,23 @@ describe Import::BitbucketController do
end
it
"updates access token"
do
access_token
=
double
(
token:
token
,
secret:
secret
)
allow_any_instance_of
(
Gitlab
::
BitbucketImport
::
Client
).
expires_at
=
Time
.
now
+
1
.
day
expires_in
=
1
.
day
access_token
=
double
(
token:
token
,
secret:
secret
,
expires_at:
expires_at
,
expires_in:
expires_in
,
refresh_token:
refresh_token
)
allow_any_instance_of
(
OAuth2
::
Client
).
to
receive
(
:get_token
).
and_return
(
access_token
)
stub_omniauth_provider
(
'bitbucket'
)
get
:callback
expect
(
session
[
:bitbucket_access_token
]).
to
eq
(
token
)
expect
(
session
[
:bitbucket_access_token_secret
]).
to
eq
(
secret
)
expect
(
session
[
:bitbucket_token
]).
to
eq
(
token
)
expect
(
session
[
:bitbucket_refresh_token
]).
to
eq
(
refresh_token
)
expect
(
session
[
:bitbucket_expires_at
]).
to
eq
(
expires_at
)
expect
(
session
[
:bitbucket_expires_in
]).
to
eq
(
expires_in
)
expect
(
controller
).
to
redirect_to
(
status_import_bitbucket_url
)
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