Skip to content

Commit

Permalink
feature: add tests to sanitize feat
Browse files Browse the repository at this point in the history
  • Loading branch information
yashin5 authored and rai200890 committed Jan 22, 2020
1 parent ac4ca3d commit 62845ac
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.7.0] - 2020-01-22

### Added

- Added logger sanitization funcionality

## [0.6.1] - 2019-12-30

### Fixed
Expand Down Expand Up @@ -47,7 +53,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial version

[Unreleased]: https://github.com/rai200890/ecto-job-scheduler/compare/v0.6.1...HEAD
[Unreleased]: https://github.com/rai200890/ecto-job-scheduler/compare/v0.7.0...HEAD
[0.7.0]: https://github.com/rai200890/ecto-job-scheduler/compare/v0.6.1...v0.7.0
[0.6.1]: https://github.com/rai200890/ecto-job-scheduler/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/rai200890/ecto-job-scheduler/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/rai200890/ecto-job-scheduler/compare/v0.4.0...v0.5.0
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.1
0.7.0
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ config :ecto_job_scheduler, EctoJobScheduler.Test.TestJobNotMultiError, max_atte
sanitize_fun = fn params ->
params
|> Map.delete("cpf")
|> Map.drop(["gokou", "xablau"])
|> Map.drop(["little master", "xablau"])
end

config :ecto_job_scheduler, sanitizer: sanitize_fun
Expand Down
6 changes: 2 additions & 4 deletions lib/job.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ defmodule EctoJobScheduler.Job do
{context, params} = Map.pop(params, "context", %{})

job_context = %{
"params" => params,
"params" => params |> sanitizer().(),
"attempt" => attempt,
"max_attempts" => max_attempts
}

Context.put(context)

job_context
|> sanitizer().()
|> Context.put()
Context.put(job_context)

Logger.info("Attempting to run #{inspect(__MODULE__)} #{attempt} out of #{max_attempts}")

Expand Down
3 changes: 3 additions & 0 deletions test/job_queue_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ defmodule EctoJobScheduler.JobQueueTest do
test "when job returns multi and return is successful, should delete job" do
job_args = %{
"type" => "TestJob",
"little master" => "Rai99",
"cpf" => "12345678910",
"xablau" => "jo",
"context" => %{some: :thing}
}

Expand Down

0 comments on commit 62845ac

Please sign in to comment.