refactor test
This commit is contained in:
parent
676c32372f
commit
0f83cb1705
107
spec/fixtures/input.json
vendored
107
spec/fixtures/input.json
vendored
@ -1,107 +0,0 @@
|
||||
{
|
||||
"scan_info": {
|
||||
"app_path": "/home/miguemasx/developer/dockerize-rails",
|
||||
"rails_version": "5.2.2",
|
||||
"security_warnings": 1,
|
||||
"start_time": "2019-10-25 11:25:31 +0200",
|
||||
"end_time": "2019-10-25 11:25:31 +0200",
|
||||
"duration": 0.108293375,
|
||||
"checks_performed": [
|
||||
"BasicAuth",
|
||||
"BasicAuthTimingAttack",
|
||||
"ContentTag",
|
||||
"CookieSerialization",
|
||||
"CreateWith",
|
||||
"CrossSiteScripting",
|
||||
"DefaultRoutes",
|
||||
"Deserialize",
|
||||
"DetailedExceptions",
|
||||
"DigestDoS",
|
||||
"DynamicFinders",
|
||||
"EscapeFunction",
|
||||
"Evaluation",
|
||||
"Execute",
|
||||
"FileAccess",
|
||||
"FileDisclosure",
|
||||
"FilterSkipping",
|
||||
"ForgerySetting",
|
||||
"HeaderDoS",
|
||||
"I18nXSS",
|
||||
"JRubyXML",
|
||||
"JSONEncoding",
|
||||
"JSONParsing",
|
||||
"LinkTo",
|
||||
"LinkToHref",
|
||||
"MailTo",
|
||||
"MassAssignment",
|
||||
"MimeTypeDoS",
|
||||
"ModelAttrAccessible",
|
||||
"ModelAttributes",
|
||||
"ModelSerialize",
|
||||
"NestedAttributes",
|
||||
"NestedAttributesBypass",
|
||||
"NumberToCurrency",
|
||||
"PermitAttributes",
|
||||
"QuoteTableName",
|
||||
"Redirect",
|
||||
"RegexDoS",
|
||||
"Render",
|
||||
"RenderDoS",
|
||||
"RenderInline",
|
||||
"ResponseSplitting",
|
||||
"RouteDoS",
|
||||
"SQL",
|
||||
"SQLCVEs",
|
||||
"SSLVerify",
|
||||
"SafeBufferManipulation",
|
||||
"SanitizeMethods",
|
||||
"SelectTag",
|
||||
"SelectVulnerability",
|
||||
"Send",
|
||||
"SendFile",
|
||||
"SessionManipulation",
|
||||
"SessionSettings",
|
||||
"SimpleFormat",
|
||||
"SingleQuotes",
|
||||
"SkipBeforeFilter",
|
||||
"SprocketsPathTraversal",
|
||||
"StripTags",
|
||||
"SymbolDoSCVE",
|
||||
"TranslateBug",
|
||||
"UnsafeReflection",
|
||||
"ValidationRegex",
|
||||
"WithoutProtection",
|
||||
"XMLDoS",
|
||||
"YAMLParsing"
|
||||
],
|
||||
"number_of_controllers": 2,
|
||||
"number_of_models": 2,
|
||||
"number_of_templates": 7,
|
||||
"ruby_version": "2.6.3",
|
||||
"brakeman_version": "4.7.0"
|
||||
},
|
||||
"warnings": [
|
||||
{
|
||||
"warning_type": "Mass Assignment",
|
||||
"warning_code": 70,
|
||||
"fingerprint": "5b486a498b14e1a12361c50863e2770c966799c9d5c6b6b9ab9bd8797c28a986",
|
||||
"check_name": "MassAssignment",
|
||||
"message": "Parameters should be whitelisted for mass assignment",
|
||||
"file": "app/controllers/posts_controller.rb",
|
||||
"line": 17,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/",
|
||||
"code": "params.permit!",
|
||||
"render_path": null,
|
||||
"location": {
|
||||
"type": "method",
|
||||
"class": "PostsController",
|
||||
"method": "new"
|
||||
},
|
||||
"user_input": null,
|
||||
"confidence": "High"
|
||||
}
|
||||
],
|
||||
"ignored_warnings": [],
|
||||
"errors": [],
|
||||
"obsolete": []
|
||||
}
|
||||
@ -8,7 +8,11 @@ describe ReportAdapter do
|
||||
end
|
||||
|
||||
let(:spec_annotations) do
|
||||
JSON(File.read('./spec/fixtures/annotations.json'))
|
||||
JSON(File.read('./spec/fixtures/output/annotations.json'))
|
||||
end
|
||||
|
||||
let(:spec_summary) do
|
||||
File.read('./spec/fixtures/output/summary.md')
|
||||
end
|
||||
|
||||
let(:adapter) { ReportAdapter }
|
||||
@ -20,7 +24,7 @@ describe ReportAdapter do
|
||||
|
||||
it '.summary' do
|
||||
result = adapter.summary(brakeman_report)
|
||||
expect(result).to be_a(String)
|
||||
expect(result).to eq(spec_summary)
|
||||
end
|
||||
|
||||
it '.annotations' do
|
||||
|
||||
Reference in New Issue
Block a user