Skip to content

Commit

Permalink
#1264 WIP Added custom fields, tests still fail
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet committed Feb 25, 2021
1 parent 2f67146 commit fc4155d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/services/CaseSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class CaseSrv @Inject() (
.richCustomFields
.toList
.toTry { c =>
caseCustomFieldSrv.create(CaseCustomField(), richCase.`case`, c.customField)
createCustomField(richCase.`case`, EntityIdOrName(c.customField.name), c.value, c.order)
}
)
_ = cases.map(remove(_))
Expand Down
6 changes: 5 additions & 1 deletion thehive/test/org/thp/thehive/services/CaseSrvTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ class CaseSrvTest extends PlaySpecification with TestAppBuilder {
case21.clone().procedure.toSeq.size mustEqual 1
case22.clone().procedure.toSeq.size mustEqual 2
case23.clone().procedure.toSeq.size mustEqual 0
// TODO CustomFields
// CustomFields
case21.clone().customFields.toSeq.size mustEqual 0
case22.clone().customFields.toSeq.size mustEqual 1
case23.clone().customFields.toSeq.size mustEqual 1

for {
c21 <- case21.clone().getOrFail("Case")
Expand All @@ -423,6 +426,7 @@ class CaseSrvTest extends PlaySpecification with TestAppBuilder {
mergedCase.clone().tasks.toSeq.size mustEqual 3
mergedCase.clone().observables.toSeq.size mustEqual 3
mergedCase.clone().procedure.toSeq.size mustEqual 3
mergedCase.clone().customFields.toSeq.size mustEqual 2
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion thehive/test/resources/data/CaseCustomField.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[
{"from": "case3", "to": "string1", "stringValue": "string1 custom field"},
{"from": "case3", "to": "boolean1", "booleanValue": true}
{"from": "case3", "to": "boolean1", "booleanValue": true},
{"from": "caseMerge22", "to": "string1", "stringValue": "merge string1"},
{"from": "caseMerge23", "to": "boolean1", "booleanValue": true}
]

0 comments on commit fc4155d

Please sign in to comment.