-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch content type during import (#5090)
Co-authored-by: Simon Dumas <simon.dumas@epfl.ch>
- Loading branch information
Showing
7 changed files
with
98 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
ship/src/test/scala/ch/epfl/bluebrain/nexus/ship/files/FileProcessorSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ch.epfl.bluebrain.nexus.ship.files | ||
|
||
import akka.http.scaladsl.model.{ContentTypes, MediaTypes} | ||
import ch.epfl.bluebrain.nexus.delta.kernel.http.MediaTypeDetectorConfig | ||
import ch.epfl.bluebrain.nexus.testkit.mu.NexusSuite | ||
|
||
class FileProcessorSuite extends NexusSuite { | ||
|
||
implicit private val mediaTypeDetector: MediaTypeDetectorConfig = MediaTypeDetectorConfig( | ||
"json" -> MediaTypes.`application/json`, | ||
"pdf" -> MediaTypes.`application/pdf` | ||
) | ||
|
||
test("Return a new content type matching the config") { | ||
assertEquals( | ||
FileProcessor.patchMediaType("file.json", None), | ||
Some(ContentTypes.`application/json`) | ||
) | ||
} | ||
|
||
test("Return the original content type") { | ||
assertEquals( | ||
FileProcessor.patchMediaType("file.", Some(ContentTypes.`text/csv(UTF-8)`)), | ||
Some(ContentTypes.`text/csv(UTF-8)`) | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters