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
Léo-Paul Géneau
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
Show 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'
FactoryGirl
.
define
do
factory
:gpg_key
do
key
GpgHelpers
.
public_key
key
GpgHelpers
::
User1
.
public_key
end
end
spec/lib/gitlab/gpg_spec.rb
View file @
eb77e106
...
...
@@ -4,7 +4,7 @@ describe Gitlab::Gpg do
describe
'.fingerprints_from_key'
do
it
'returns the fingerprint'
do
expect
(
described_class
.
fingerprints_from_key
(
GpgHelpers
.
public_key
)
described_class
.
fingerprints_from_key
(
GpgHelpers
::
User1
.
public_key
)
).
to
eq
[
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
]
end
...
...
@@ -19,7 +19,7 @@ describe Gitlab::Gpg do
it
'stores the key in the keychain'
do
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
[]
end
...
...
@@ -27,7 +27,7 @@ describe Gitlab::Gpg do
describe
'.remove_from_keychain'
,
:gpg
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
[]
Gitlab
::
Gpg
.
remove_from_keychain
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
...
...
spec/models/commit_spec.rb
View file @
eb77e106
...
...
@@ -422,11 +422,11 @@ eos
context
'signed commit'
,
:gpg
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:
[
GpgHelpers
.
signed_commit_signature
,
GpgHelpers
.
signed_commit_base_data
GpgHelpers
::
User1
.
signed_commit_signature
,
GpgHelpers
::
User1
.
signed_commit_base_data
])
allow
(
raw_commit
).
to
receive
:save!
...
...
@@ -440,8 +440,8 @@ eos
it
'returns an invalid signature if the public commit is unknown'
,
:gpg
do
raw_commit
=
double
(
:raw_commit
,
signature:
[
GpgHelpers
.
signed_commit_signature
,
GpgHelpers
.
signed_commit_base_data
GpgHelpers
::
User1
.
signed_commit_signature
,
GpgHelpers
::
User1
.
signed_commit_base_data
])
allow
(
raw_commit
).
to
receive
:save!
...
...
spec/models/gpg_key_spec.rb
View file @
eb77e106
...
...
@@ -16,7 +16,7 @@ describe GpgKey do
context
'callbacks'
,
:gpg
do
describe
'extract_fingerprint'
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?
expect
(
gpg_key
.
fingerprint
).
to
eq
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
end
...
...
@@ -24,7 +24,7 @@ describe GpgKey do
describe
'add_to_keychain'
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
end
end
...
...
spec/support/gpg_helpers.rb
View file @
eb77e106
module
GpgHelpers
module
User1
extend
self
def
signed_commit_signature
...
...
@@ -219,4 +220,89 @@ module GpgHelpers
-----END PGP PUBLIC KEY BLOCK-----
PUBLICKEY
end
def
key_id
'972E97C0'
end
end
module
User2
extend
self
def
private_key
<<~
KEY
.
strip
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v1
lQHYBFiuqioBBADg46jkiATWMy9t1npxFWJ77xibPXdUo36LAZgZ6uGungSzcFL4
50bdEyMMGm5RJp6DCYkZlwQDlM//YEqwf0Cmq/AibC5m9bHr7hf5sMxl40ssJ4fj
dzT6odihO0vxD2ARSrtiwkESzFxjJ51mjOfdPvAGf0ucxzgeRfUlCrM3kwARAQAB
AAP8CJlDFnbywR9dWfqBxi19sFMOk/smCObNQanuTcx6CDcu4zHi0Yxx6BoNCQES
cDRCLX5HevnpZngzQB3qa7dga+yqxKzwO8v0P0hliL81B1ZVXUk9TWhBj3NS3m3v
+kf2XeTxuZFb9fj44/4HpfbQ2yazTs/Xa+/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GCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEL+d
kl+RHv1lQhsD/0LDi008hCeoZdGMuwy2N5FMUusYg/X1tRQ6E0JcYYjvvE5oIZoX
bVN0yLLD99P0rt6TSlt05CC7RPVPCNpKxKbF+TZMjMJiOi13XmY5Yti77ZMdBZtD
7HeBzjkWCVuR6k8eIwy83niHGI6p6G87Q6XxvDjQ7wdBCNBpwkzmTYIBuI0EWK6q
KgEEAN7mdR1U5xtmWfE6OXQoEBP4DlubIEtRPQGYs+yYDg+5cNK2Hta+Js8LzBwJ
0JhWTQhExid5lSJar+jlziu2F8tHiODySu6+iZDgTh3iHIjpHQwvFdhndcy7rtW5
JwWBstRHDV5FnXoA13c1zVW4VbuazS8IbSJ0HyJJkGhQtorxABEBAAGInwQYAQIA
CQUCWK6qKgIbDAAKCRC/nZJfkR79ZUIIBADVsEMK5U9gRS1lfBcfsJYN9fpnI5E6
tC2lrt6LngJbqEpfd9gek6K7jIeuiaMaUg1OOMdyWwmmf+qaImLOQH3/GXshFZX5
FWkOyFnebKY6V2kuIqAjn5GXqZm07hO0z0FjOIgQLbiH4iRosHKVljPiiB9vNcoX
wnG0c8xS7AlUMQ==
=Erp5
-----END PGP PUBLIC KEY BLOCK-----
KEY
end
def
key_id
'911EFD65'
end
def
signature
'6D494CA6FC90C0CAE0910E42BF9D925F911EFD65'
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