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
eb77e106
Commit
eb77e106
authored
Feb 23, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add second gpg key for specs
parent
87c0fd34
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
309 additions
and
223 deletions
+309
-223
spec/factories/gpg_keys.rb
spec/factories/gpg_keys.rb
+1
-1
spec/lib/gitlab/gpg_spec.rb
spec/lib/gitlab/gpg_spec.rb
+3
-3
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+5
-5
spec/models/gpg_key_spec.rb
spec/models/gpg_key_spec.rb
+2
-2
spec/support/gpg_helpers.rb
spec/support/gpg_helpers.rb
+298
-212
No files found.
spec/factories/gpg_keys.rb
View file @
eb77e106
...
@@ -2,6 +2,6 @@ require_relative '../support/gpg_helpers'
...
@@ -2,6 +2,6 @@ require_relative '../support/gpg_helpers'
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:gpg_key
do
factory
:gpg_key
do
key
GpgHelpers
.
public_key
key
GpgHelpers
::
User1
.
public_key
end
end
end
end
spec/lib/gitlab/gpg_spec.rb
View file @
eb77e106
...
@@ -4,7 +4,7 @@ describe Gitlab::Gpg do
...
@@ -4,7 +4,7 @@ describe Gitlab::Gpg do
describe
'.fingerprints_from_key'
do
describe
'.fingerprints_from_key'
do
it
'returns the fingerprint'
do
it
'returns the fingerprint'
do
expect
(
expect
(
described_class
.
fingerprints_from_key
(
GpgHelpers
.
public_key
)
described_class
.
fingerprints_from_key
(
GpgHelpers
::
User1
.
public_key
)
).
to
eq
[
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
]
).
to
eq
[
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
]
end
end
...
@@ -19,7 +19,7 @@ describe Gitlab::Gpg do
...
@@ -19,7 +19,7 @@ describe Gitlab::Gpg do
it
'stores the key in the keychain'
do
it
'stores the key in the keychain'
do
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
to
eq
[]
Gitlab
::
Gpg
.
add_to_keychain
(
GpgHelpers
.
public_key
)
Gitlab
::
Gpg
.
add_to_keychain
(
GpgHelpers
::
User1
.
public_key
)
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
not_to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
not_to
eq
[]
end
end
...
@@ -27,7 +27,7 @@ describe Gitlab::Gpg do
...
@@ -27,7 +27,7 @@ describe Gitlab::Gpg do
describe
'.remove_from_keychain'
,
:gpg
do
describe
'.remove_from_keychain'
,
:gpg
do
it
'removes the key from the keychain'
do
it
'removes the key from the keychain'
do
Gitlab
::
Gpg
.
add_to_keychain
(
GpgHelpers
.
public_key
)
Gitlab
::
Gpg
.
add_to_keychain
(
GpgHelpers
::
User1
.
public_key
)
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
not_to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
not_to
eq
[]
Gitlab
::
Gpg
.
remove_from_keychain
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
Gitlab
::
Gpg
.
remove_from_keychain
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
...
...
spec/models/commit_spec.rb
View file @
eb77e106
...
@@ -422,11 +422,11 @@ eos
...
@@ -422,11 +422,11 @@ eos
context
'signed commit'
,
:gpg
do
context
'signed commit'
,
:gpg
do
it
'returns a valid signature if the public key is known'
do
it
'returns a valid signature if the public key is known'
do
GPGME
::
Key
.
import
(
GpgHelpers
.
public_key
)
GPGME
::
Key
.
import
(
GpgHelpers
::
User1
.
public_key
)
raw_commit
=
double
(
:raw_commit
,
signature:
[
raw_commit
=
double
(
:raw_commit
,
signature:
[
GpgHelpers
.
signed_commit_signature
,
GpgHelpers
::
User1
.
signed_commit_signature
,
GpgHelpers
.
signed_commit_base_data
GpgHelpers
::
User1
.
signed_commit_base_data
])
])
allow
(
raw_commit
).
to
receive
:save!
allow
(
raw_commit
).
to
receive
:save!
...
@@ -440,8 +440,8 @@ eos
...
@@ -440,8 +440,8 @@ eos
it
'returns an invalid signature if the public commit is unknown'
,
:gpg
do
it
'returns an invalid signature if the public commit is unknown'
,
:gpg
do
raw_commit
=
double
(
:raw_commit
,
signature:
[
raw_commit
=
double
(
:raw_commit
,
signature:
[
GpgHelpers
.
signed_commit_signature
,
GpgHelpers
::
User1
.
signed_commit_signature
,
GpgHelpers
.
signed_commit_base_data
GpgHelpers
::
User1
.
signed_commit_base_data
])
])
allow
(
raw_commit
).
to
receive
:save!
allow
(
raw_commit
).
to
receive
:save!
...
...
spec/models/gpg_key_spec.rb
View file @
eb77e106
...
@@ -16,7 +16,7 @@ describe GpgKey do
...
@@ -16,7 +16,7 @@ describe GpgKey do
context
'callbacks'
,
:gpg
do
context
'callbacks'
,
:gpg
do
describe
'extract_fingerprint'
do
describe
'extract_fingerprint'
do
it
'extracts the fingerprint from the gpg key'
do
it
'extracts the fingerprint from the gpg key'
do
gpg_key
=
described_class
.
new
(
key:
GpgHelpers
.
public_key
)
gpg_key
=
described_class
.
new
(
key:
GpgHelpers
::
User1
.
public_key
)
gpg_key
.
valid?
gpg_key
.
valid?
expect
(
gpg_key
.
fingerprint
).
to
eq
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
expect
(
gpg_key
.
fingerprint
).
to
eq
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
end
end
...
@@ -24,7 +24,7 @@ describe GpgKey do
...
@@ -24,7 +24,7 @@ describe GpgKey do
describe
'add_to_keychain'
do
describe
'add_to_keychain'
do
it
'calls add_to_keychain after create'
do
it
'calls add_to_keychain after create'
do
expect
(
Gitlab
::
Gpg
).
to
receive
(
:add_to_keychain
).
with
(
GpgHelpers
.
public_key
)
expect
(
Gitlab
::
Gpg
).
to
receive
(
:add_to_keychain
).
with
(
GpgHelpers
::
User1
.
public_key
)
create
:gpg_key
create
:gpg_key
end
end
end
end
...
...
spec/support/gpg_helpers.rb
View file @
eb77e106
This diff is collapsed.
Click to expand it.
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