diff --git a/README.md b/README.md index 6d1d420..215fe9f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For more information about the `SmartCity.TestDataGenerator`, please see [https: ```elixir def deps do [ - {:smart_city_test, "~> 0.5.0"} + {:smart_city_test, "~> 0.5.1"} ] end ``` @@ -21,4 +21,3 @@ end ## License SmartCity is released under the Apache 2.0 license - see the license at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) - diff --git a/lib/smart_city/test_data_generator.ex b/lib/smart_city/test_data_generator.ex index cc5776b..f16ad48 100644 --- a/lib/smart_city/test_data_generator.ex +++ b/lib/smart_city/test_data_generator.ex @@ -29,7 +29,7 @@ defmodule SmartCity.TestDataGenerator do business: %{ dataTitle: title, description: Faker.Lorem.Shakespeare.hamlet(), - modifiedDate: Faker.Date.backward(360), + modifiedDate: Faker.Date.backward(360) |> Date.to_iso8601(), orgTitle: org, contactName: Faker.Name.name(), contactEmail: Faker.Internet.email(), diff --git a/lib/smart_city/test_data_generator/payload.ex b/lib/smart_city/test_data_generator/payload.ex index b3ed94e..1654aa8 100644 --- a/lib/smart_city/test_data_generator/payload.ex +++ b/lib/smart_city/test_data_generator/payload.ex @@ -33,7 +33,7 @@ defmodule SmartCity.TestDataGenerator.Payload do Enum.reduce(columns, %{}, &generate_value/2) end - defp generate_value(%{"name" => column, "type" => type}, acc) do + defp generate_value(%{name: column, type: type}, acc) do Map.put(acc, column, generate_from_type({column, type})) end diff --git a/lib/smart_city/test_data_generator/schema.ex b/lib/smart_city/test_data_generator/schema.ex index fde5305..453711c 100644 --- a/lib/smart_city/test_data_generator/schema.ex +++ b/lib/smart_city/test_data_generator/schema.ex @@ -12,12 +12,12 @@ defmodule SmartCity.TestDataGenerator.Schema do %{ "schema" => [ %{ - "name" => "id", - "type" => "int" + name: "id", + type: "int" }, %{ - "name" => "name", - "type" => "string" + name: "name", + type: "string" } ] }} @@ -28,20 +28,20 @@ defmodule SmartCity.TestDataGenerator.Schema do %{ "schema" => [ %{ - "name" => "big", - "type" => "string" + name: "big", + type: "string" }, %{ - "name" => "bigbig", - "type" => "int" + name: "bigbig", + type: "int" }, %{ - "name" => "data", - "type" => "float" + name: "data", + type: "float" }, %{ - "name" => "bigger_data", - "type" => "date" + name: "bigger_data", + type: "date" } ] }} @@ -52,16 +52,16 @@ defmodule SmartCity.TestDataGenerator.Schema do %{ "schema" => [ %{ - "name" => "go", - "type" => "int" + name: "go", + type: "int" }, %{ - "name" => "fund", - "type" => "string" + name: "fund", + type: "string" }, %{ - "name" => "yourself", - "type" => "string" + name: "yourself", + type: "string" } ] }} @@ -72,24 +72,24 @@ defmodule SmartCity.TestDataGenerator.Schema do %{ "schema" => [ %{ - "name" => "my_int", - "type" => "int" + name: "my_int", + type: "int" }, %{ - "name" => "my_string", - "type" => "string" + name: "my_string", + type: "string" }, %{ - "name" => "my_date", - "type" => "date" + name: "my_date", + type: "date" }, %{ - "name" => "my_float", - "type" => "float" + name: "my_float", + type: "float" }, %{ - "name" => "my_boolean", - "type" => "boolean" + name: "my_boolean", + type: "boolean" } ] }} diff --git a/mix.exs b/mix.exs index 1814dc6..f0c77b2 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule SmartCityTest.MixProject do def project do [ app: :smart_city_test, - version: "0.5.0", + version: "0.5.1", elixir: "~> 1.8", start_permanent: Mix.env() == :prod, description: description(), diff --git a/mix.lock b/mix.lock index 089b364..8b65d42 100644 --- a/mix.lock +++ b/mix.lock @@ -1,13 +1,14 @@ %{ "brod": {:hex, :brod, "3.8.1", "74426e2d27989cd7f973599bc209c899dca8588068d27a2a37ca1b4bf8823c2a", [:make, :rebar, :rebar3], [{:kafka_protocol, "2.2.9", [hex: :kafka_protocol, repo: "hexpm", optional: false]}, {:supervisor3, "1.1.8", [hex: :supervisor3, repo: "hexpm", optional: false]}], "hexpm"}, "brook": {:hex, :brook, "0.1.1", "d855e06824f7cb34a8ee4c0d260cf86b67a728e3a5a6c32d02a70c9fd042ce30", [:mix], [{:elsa, "~> 0.7.1", [hex: :elsa, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:redix, "~> 0.10.2", [hex: :redix, repo: "hexpm", optional: false]}], "hexpm"}, + "brook_serializer": {:hex, :brook_serializer, "1.0.0", "b1306e8d07669df94664267646f9a8c01746b5bee73b1ffd832f51ad35067b6a", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, "crc32cer": {:hex, :crc32cer, "0.1.3", "8984906c4b4fae6aa292c48f286a1c83b19ad44bd102287acb94d696015967ce", [:make, :rebar, :rebar3], [], "hexpm"}, - "credo": {:hex, :credo, "1.1.3", "bf31887b8914a4b7e1810ae2b5aab7c657698abbf4cca6a2335a094d57995168", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, + "credo": {:hex, :credo, "1.1.4", "c2f3b73c895d81d859cec7fcee7ffdb972c595fd8e85ab6f8c2adbf01cf7c29c", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, - "earmark": {:hex, :earmark, "1.3.3", "5e8be428fcef362692b6dbd7dc55bdc7023da26d995cb3fb19aa4bd682bfd3f9", [:mix], [], "hexpm"}, + "earmark": {:hex, :earmark, "1.4.0", "397e750b879df18198afc66505ca87ecf6a96645545585899f6185178433cc09", [:mix], [], "hexpm"}, "elsa": {:hex, :elsa, "0.7.1", "3615e3aa3c2d7b9aa165f7638fee01e8208f0c6785f9cc43f57f3f36218d7073", [:mix], [{:brod, "~> 3.7", [hex: :brod, repo: "hexpm", optional: false]}], "hexpm"}, - "ex_doc": {:hex, :ex_doc, "0.21.1", "5ac36660846967cd869255f4426467a11672fec3d8db602c429425ce5b613b90", [:mix], [{:earmark, "~> 1.3", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, + "ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, "faker": {:hex, :faker, "0.12.0", "796cbac868c86c2df6f273ea4cdf2e271860863820e479e04a374b7ee6c376b6", [:mix], [], "hexpm"}, "husky": {:hex, :husky, "1.0.3", "960fd2c74214ba3640693ff89fff39abf0a271c4ff42659e6eb8ffbc26f33927", [:mix], [{:poison, ">= 1.2.1", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"}, "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, @@ -15,11 +16,11 @@ "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.1", "c90796ecee0289dbb5ad16d3ad06f957b0cd1199769641c961cfe0b97db190e0", [:mix], [], "hexpm"}, "patiently": {:hex, :patiently, "0.2.0", "67eb139591e10c4b363ae0198e832552f191c58894731efd3bf124ec4722267a", [:mix], [], "hexpm"}, "redix": {:hex, :redix, "0.10.2", "a9eabf47898aa878650df36194aeb63966d74f5bd69d9caa37babb32dbb93c5d", [:mix], [{:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"}, - "smart_city": {:hex, :smart_city, "2.6.1", "99358cea07ac0b319a2d86d1359f3252b494256e51579cacefcb4ea5863cb6cd", [:mix], [{:brook, "~> 0.1.1", [hex: :brook, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.3", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, - "smart_city_data": {:hex, :smart_city_data, "3.0.1", "2754c29df0aca41f6494d47435264de28232c8d2b7e7f57bd0903c6f7915dd34", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:smart_city, "~> 2.6.1", [hex: :smart_city, repo: "hexpm", optional: false]}], "hexpm"}, + "smart_city": {:hex, :smart_city, "2.8.0", "e88cf8a2bb6270705a3fcd9537f38d2ba1c6a7479123c491e68f354e89b7df95", [:mix], [{:brook_serializer, "~> 1.0", [hex: :brook_serializer, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.3", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, + "smart_city_data": {:hex, :smart_city_data, "3.0.2", "3ab715fe9ee40de326dd5b1bc4518c04bed7f3cd3577cbb72f5f7866a95c4443", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:smart_city, "~> 2.7", [hex: :smart_city, repo: "hexpm", optional: false]}], "hexpm"}, "smart_city_registry": {:hex, :smart_city_registry, "4.0.0", "e3b86865b9c9340c15cfc93d7055249d1de85f53398ec3800d3d3b17b238f920", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:redix, "~> 0.9", [hex: :redix, repo: "hexpm", optional: false]}, {:smart_city, "~> 2.1", [hex: :smart_city, repo: "hexpm", optional: false]}], "hexpm"}, "snappyer": {:hex, :snappyer, "1.2.4", "6d739c534cd2339633127a2b40279be71f149e5842c5363a4d88e66efb7c1fec", [:make, :rebar, :rebar3], [], "hexpm"}, "supervisor3": {:hex, :supervisor3, "1.1.8", "5cf95c95342b589ec8d74689eea0646c0a3eb92820241e0c2d0ca4c104df92bc", [:make, :rebar, :rebar3], [], "hexpm"}, diff --git a/test/smart_city/test_data_generator/payload_test.exs b/test/smart_city/test_data_generator/payload_test.exs index 353fe57..953f969 100644 --- a/test/smart_city/test_data_generator/payload_test.exs +++ b/test/smart_city/test_data_generator/payload_test.exs @@ -15,11 +15,11 @@ defmodule SmartCity.TestDataGenerator.PayloadTest do test "get_schema returns schema as list of maps" do expected = [ - %{"name" => "my_int", "type" => "int"}, - %{"name" => "my_string", "type" => "string"}, - %{"name" => "my_date", "type" => "date"}, - %{"name" => "my_float", "type" => "float"}, - %{"name" => "my_boolean", "type" => "boolean"} + %{name: "my_int", type: "int"}, + %{name: "my_string", type: "string"}, + %{name: "my_date", type: "date"}, + %{name: "my_float", type: "float"}, + %{name: "my_boolean", type: "boolean"} ] assert Payload.get_schema(:test) == expected