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
e3c36d55
Commit
e3c36d55
authored
Aug 27, 2020
by
Heinrich Lee Yu
Committed by
Eugenia Grieff
Sep 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix x509 certificate spec
These specs needed a persisted issuer because of the issuer ID validations
parent
0422c4a6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
spec/models/x509_certificate_spec.rb
spec/models/x509_certificate_spec.rb
+10
-8
No files found.
spec/models/x509_certificate_spec.rb
View file @
e3c36d55
...
...
@@ -68,6 +68,8 @@ RSpec.describe X509Certificate do
end
describe
'validators'
do
let_it_be
(
:issuer
)
{
create
(
:x509_issuer
)
}
it
'accepts correct subject_key_identifier'
do
subject_key_identifiers
=
[
'AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB'
,
...
...
@@ -75,7 +77,7 @@ RSpec.describe X509Certificate do
]
subject_key_identifiers
.
each
do
|
identifier
|
expect
(
build
(
:x509_certificate
,
subject_key_identifier:
identifier
)).
to
be_valid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
subject_key_identifier:
identifier
)).
to
be_valid
end
end
...
...
@@ -88,7 +90,7 @@ RSpec.describe X509Certificate do
]
subject_key_identifiers
.
each
do
|
identifier
|
expect
(
build
(
:x509_certificate
,
subject_key_identifier:
identifier
)).
to
be_invalid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
subject_key_identifier:
identifier
)).
to
be_invalid
end
end
...
...
@@ -99,7 +101,7 @@ RSpec.describe X509Certificate do
]
emails
.
each
do
|
email
|
expect
(
build
(
:x509_certificate
,
email:
email
)).
to
be_valid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
email:
email
)).
to
be_valid
end
end
...
...
@@ -110,20 +112,20 @@ RSpec.describe X509Certificate do
]
emails
.
each
do
|
email
|
expect
(
build
(
:x509_certificate
,
email:
email
)).
to
be_invalid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
email:
email
)).
to
be_invalid
end
end
it
'accepts valid serial_number'
do
expect
(
build
(
:x509_certificate
,
serial_number:
123412341234
)).
to
be_valid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
serial_number:
123412341234
)).
to
be_valid
# rfc 5280 - 4.1.2.2 Serial number (20 octets is the maximum)
expect
(
build
(
:x509_certificate
,
serial_number:
1461501637330902918203684832716283019655932542975
)).
to
be_valid
expect
(
build
(
:x509_certificate
,
serial_number:
'ffffffffffffffffffffffffffffffffffffffff'
.
to_i
(
16
))).
to
be_valid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
serial_number:
1461501637330902918203684832716283019655932542975
)).
to
be_valid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
serial_number:
'ffffffffffffffffffffffffffffffffffffffff'
.
to_i
(
16
))).
to
be_valid
end
it
'rejects invalid serial_number'
do
expect
(
build
(
:x509_certificate
,
serial_number:
"sgsgfsdgdsfg"
)).
to
be_invalid
expect
(
build
(
:x509_certificate
,
x509_issuer:
issuer
,
serial_number:
"sgsgfsdgdsfg"
)).
to
be_invalid
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