Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
961e86bf
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
961e86bf
编写于
8月 17, 2016
作者:
T
Timothy Andrew
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add feature specs to cover naming and deleting U2F devices.
上级
16c44a5d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
32 addition
and
9 deletion
+32
-9
spec/features/u2f_spec.rb
spec/features/u2f_spec.rb
+28
-8
spec/support/fake_u2f_device.rb
spec/support/fake_u2f_device.rb
+4
-1
未找到文件。
spec/features/u2f_spec.rb
浏览文件 @
961e86bf
...
...
@@ -12,10 +12,12 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
end
def
register_u2f_device
(
u2f_device
=
nil
)
u2f_device
||=
FakeU2fDevice
.
new
(
page
)
name
=
FFaker
::
Name
.
first_name
u2f_device
||=
FakeU2fDevice
.
new
(
page
,
name
)
u2f_device
.
respond_to_u2f_registration
click_on
'Setup New U2F Device'
expect
(
page
).
to
have_content
(
'Your device was successfully set up'
)
fill_in
"Pick a name"
,
with:
name
click_on
'Register U2F Device'
u2f_device
end
...
...
@@ -40,13 +42,14 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
end
describe
'when 2FA via OTP is enabled'
do
it
'allows registering a new device'
do
it
'allows registering a new device
with a name
'
do
visit
profile_account_path
manage_two_factor_authentication
expect
(
page
.
body
).
to
match
(
"You've already enabled two-factor authentication using mobile"
)
register_u2f_device
u2f_device
=
register_u2f_device
expect
(
page
.
body
).
to
match
(
u2f_device
.
name
)
expect
(
page
.
body
).
to
match
(
'Your U2F device was registered'
)
end
...
...
@@ -55,15 +58,31 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
# First device
manage_two_factor_authentication
register_u2f_device
first_device
=
register_u2f_device
expect
(
page
.
body
).
to
match
(
'Your U2F device was registered'
)
# Second device
manage_two_factor_authentication
register_u2f_device
second_device
=
register_u2f_device
expect
(
page
.
body
).
to
match
(
'Your U2F device was registered'
)
expect
(
page
.
body
).
to
match
(
first_device
.
name
)
expect
(
page
.
body
).
to
match
(
second_device
.
name
)
expect
(
U2fRegistration
.
count
).
to
eq
(
2
)
end
it
'allows deleting a device'
do
visit
profile_account_path
manage_two_factor_authentication
expect
(
page
.
body
).
to
match
(
'You have 2 U2F devices registered'
)
expect
(
page
.
body
).
to
match
(
"You've already enabled two-factor authentication using mobile"
)
first_u2f_device
=
register_u2f_device
second_u2f_device
=
register_u2f_device
click_on
"Delete"
,
match: :first
expect
(
page
.
body
).
to
match
(
'Successfully deleted'
)
expect
(
page
.
body
).
not_to
match
(
first_u2f_device
.
name
)
expect
(
page
.
body
).
to
match
(
second_u2f_device
.
name
)
end
end
...
...
@@ -208,7 +227,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
describe
"when a given U2F device has not been registered"
do
it
"does not allow logging in with that particular device"
do
unregistered_device
=
FakeU2fDevice
.
new
(
page
)
unregistered_device
=
FakeU2fDevice
.
new
(
page
,
FFaker
::
Name
.
first_name
)
login_as
(
user
)
unregistered_device
.
respond_to_u2f_authentication
click_on
"Login Via U2F Device"
...
...
@@ -262,6 +281,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', feature:
end
it
"deletes u2f registrations"
do
visit
profile_account_path
expect
{
click_on
"Disable"
}.
to
change
{
U2fRegistration
.
count
}.
by
(
-
1
)
end
end
...
...
spec/support/fake_u2f_device.rb
浏览文件 @
961e86bf
class
FakeU2fDevice
def
initialize
(
page
)
attr_reader
:name
def
initialize
(
page
,
name
)
@page
=
page
@name
=
name
end
def
respond_to_u2f_registration
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录