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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4fad0ace
Commit
4fad0ace
authored
Nov 12, 2018
by
Sanad Liaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use RestClient with verify_ssl: false in api_fabricator
parent
4b2569cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
101 deletions
+100
-101
qa/qa/resource/api_fabricator.rb
qa/qa/resource/api_fabricator.rb
+9
-7
qa/qa/resource/base.rb
qa/qa/resource/base.rb
+1
-0
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
...ures/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
+90
-94
No files found.
qa/qa/resource/api_fabricator.rb
View file @
4fad0ace
# frozen_string_literal: true
require
'airborne'
require
'active_support/core_ext/object/deep_dup'
require
'capybara/dsl'
module
QA
module
Resource
module
ApiFabricator
include
Airborne
include
Capybara
::
DSL
HTTP_STATUS_OK
=
200
...
...
@@ -56,8 +54,10 @@ module QA
end
def
api_get_from
(
get_path
)
url
=
Runtime
::
API
::
Request
.
new
(
api_client
,
get_path
).
url
response
=
get
(
url
)
response
=
RestClient
::
Request
.
execute
(
method: :get
,
url:
Runtime
::
API
::
Request
.
new
(
api_client
,
get_path
).
url
,
verify_ssl:
false
)
unless
response
.
code
==
HTTP_STATUS_OK
raise
ResourceNotFoundError
,
"Resource at
#{
url
}
could not be found (
#{
response
.
code
}
): `
#{
response
}
`."
...
...
@@ -67,9 +67,11 @@ module QA
end
def
api_post
response
=
post
(
Runtime
::
API
::
Request
.
new
(
api_client
,
api_post_path
).
url
,
api_post_body
)
response
=
RestClient
::
Request
.
execute
(
method: :post
,
url:
Runtime
::
API
::
Request
.
new
(
api_client
,
api_post_path
).
url
,
payload:
api_post_body
,
verify_ssl:
false
)
unless
response
.
code
==
HTTP_STATUS_CREATED
raise
ResourceFabricationFailedError
,
"Fabrication of
#{
self
.
class
.
name
}
using the API failed (
#{
response
.
code
}
) with `
#{
response
}
`."
...
...
qa/qa/resource/base.rb
View file @
4fad0ace
...
...
@@ -2,6 +2,7 @@
require
'forwardable'
require
'capybara/dsl'
require
'active_support/core_ext/array/extract_options'
module
QA
module
Resource
...
...
qa/qa/specs/features/browser_ui/1_manage/ee_group/group_ldap_sync_spec.rb
View file @
4fad0ace
# frozen_string_literal: true
module
QA
context
'Manage'
do
context
'Manage'
,
:orchestrated
,
:ldap_tls
,
:ldap_no_tls
do
it
'Has LDAP user synced using group cn method'
do
users
=
[
{
name:
'ENG User 2'
,
username:
'enguser2'
,
email:
'enguser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'ENG User 3'
,
username:
'enguser3'
,
email:
'enguser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
create_users_via_api
(
users
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
create_sandbox_group_with_user
(
user:
'enguser1'
,
group_name:
'Synched-engineering-group'
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_sync_method
(
'LDAP Group cn'
)
page
.
set_group_cn
(
'Engineering'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
verify_users_synched
([
'ENG User 2'
,
'ENG User 3'
])
it
'Has LDAP user synced using group cn method'
do
users
=
[
{
name:
'ENG User 2'
,
username:
'enguser2'
,
email:
'enguser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'ENG User 3'
,
username:
'enguser3'
,
email:
'enguser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=enguser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
create_users_via_api
(
users
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
create_sandbox_group_with_user
(
user:
'enguser1'
,
group_name:
'Synched-engineering-group'
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_sync_method
(
'LDAP Group cn'
)
page
.
set_group_cn
(
'Engineering'
)
page
.
click_add_sync_button
end
it
'Has LDAP user synced using user filter method'
do
users
=
[
{
name:
'HR User 2'
,
username:
'hruser2'
,
email:
'hruser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'HR User 3'
,
username:
'hruser3'
,
email:
'hruser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
create_users_via_api
(
users
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
create_sandbox_group_with_user
(
user:
'hruser1'
,
group_name:
'Synched-human-resources-group'
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_user_filter
(
'(&(objectClass=person)(cn=HR*))'
)
page
.
click_add_sync_button
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
verify_users_synched
([
'ENG User 2'
,
'ENG User 3'
])
end
verify_users_synched
([
'HR User 2'
,
'HR User 3'
])
it
'Has LDAP user synced using user filter method'
do
users
=
[
{
name:
'HR User 2'
,
username:
'hruser2'
,
email:
'hruser2@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser2,ou=people,ou=global groups,dc=example,dc=org'
},
{
name:
'HR User 3'
,
username:
'hruser3'
,
email:
'hruser3@example.org'
,
provider:
'ldapmain'
,
extern_uid:
'uid=hruser3,ou=people,ou=global groups,dc=example,dc=org'
}
]
create_users_via_api
(
users
)
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
create_sandbox_group_with_user
(
user:
'hruser1'
,
group_name:
'Synched-human-resources-group'
)
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_ldap_sync_settings
)
EE
::
Page
::
Group
::
Settings
::
LDAPSync
.
perform
do
|
page
|
page
.
set_user_filter
(
'(&(objectClass=person)(cn=HR*))'
)
page
.
click_add_sync_button
end
def
create_users_via_api
(
users
)
users
.
each
do
|
user
|
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
username
=
user
[
:username
]
resource
.
name
=
user
[
:name
]
resource
.
email
=
user
[
:email
]
resource
.
extern_uid
=
user
[
:extern_uid
]
resource
.
provider
=
user
[
:provider
]
end
end
EE
::
Page
::
Group
::
Menu
.
perform
(
&
:go_to_members
)
verify_users_synched
([
'HR User 2'
,
'HR User 3'
])
end
def
create_users_via_api
(
users
)
users
.
each
do
|
user
|
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
username
=
user
[
:username
]
resource
.
name
=
user
[
:name
]
resource
.
email
=
user
[
:email
]
resource
.
extern_uid
=
user
[
:extern_uid
]
resource
.
provider
=
user
[
:provider
]
end
end
end
def
create_sandbox_group_with_user
(
user:
nil
,
group_name:
nil
)
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
user
,
password:
'password'
)
end
def
create_sandbox_group_with_user
(
user:
nil
,
group_name:
nil
)
Page
::
Main
::
Login
.
perform
do
|
login_page
|
login_page
.
sign_in_using_ldap_credentials
(
username:
user
,
password:
'password'
)
end
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
Page
::
Main
::
Menu
.
perform
do
|
menu
|
expect
(
menu
).
to
have_personal_area
end
Resource
::
Sandbox
.
fabricate_via_browser_ui!
do
|
resource
|
resource
.
path
=
"
#{
group_name
}
-
#{
SecureRandom
.
hex
(
4
)
}
"
end
Resource
::
Sandbox
.
fabricate_via_browser_ui!
do
|
resource
|
resource
.
path
=
"
#{
group_name
}
-
#{
SecureRandom
.
hex
(
4
)
}
"
end
end
def
verify_users_synched
(
expected_users
)
EE
::
Page
::
Group
::
Members
.
perform
do
|
page
|
page
.
click_sync_now
users_synchronised
=
page
.
with_retry
(
reload:
true
)
do
expected_users
.
map
{
|
user
|
page
.
has_content?
(
user
)
}.
reduce
(
true
)
{
|
a
,
b
|
a
&&
b
}
end
expect
(
users_synchronised
).
to
be_truthy
def
verify_users_synched
(
expected_users
)
EE
::
Page
::
Group
::
Members
.
perform
do
|
page
|
page
.
click_sync_now
users_synchronised
=
page
.
with_retry
(
reload:
true
)
do
expected_users
.
map
{
|
user
|
page
.
has_content?
(
user
)
}.
reduce
(
true
)
{
|
a
,
b
|
a
&&
b
}
end
expect
(
users_synchronised
).
to
be_truthy
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