   end
 
   defp print_category(report, tests) do
-    Enum.each(tests, fn {test, definition} ->
-      print_test(report[test] || %{}, definition)
+    Enum.each(tests, fn test ->
+      print_test(
+        report[test[:key]] || %{},
+        test
+      )
     end)
   end
 

    if report["error"] do
      IO.puts("  Error: #{report["error"]}")
    else
      Enum.each(report_definition(), fn {component, definition} ->
        IO.puts("  #{definition[:label]}")
        print_component(report[component] || %{}, definition[:tests])
      end)
    end


  end

  defp report_definition do
    [
      %{
        :key => "extension",
        :label => "Extension tests",
        :tests => [
          {
            "config",
            [
              %{
                :key => "valid",
                :label => "Configuration",
                :values => %{true: "valid", false: "invalid"}
              }
            ]
          }
        ]
      },
      %{
        :key => "agent",
        :label => "Agent tests",
        :tests => [
          {
            "boot",
            [
              %{
                :key => "started",
                :label => "Started",
                :values => %{true: "started", false: "not started"}
              }
            ]
          },
          {
            "host",
            [
              %{
                :key => "uid",
                :label => "Process user id"
              },
              %{
                :key => "gid",
                :label => "Process user group id"
              }
            ]
          },
          {
            "config",
            [
              %{
                :key => "valid",
                :label => "Configuration",
                :values => %{true: "valid", false: "invalid"}
              }
            ]
          },
          {
            "logger",
            [
              %{
                :key => "started",
                :label => "Logger",
                :values => %{true: "started", false: "not started"}
              }
            ]
          },
          {
            "working_directory_stat",
            [
              %{
                :key => "uid",
                :label => "Working directory user id"
              },
              %{
                :key => "gid",
                :label => "Working directory user group id"
              },
              %{
                :key => "mode",
                :label => "Working directory permissions"
              }
            ]
          },
          {
            "lock_path",
            [
              %{
                :key => "created",
                :label => "Lock path",
                :values => %{true: "writable", false: "not writable"}
              }
            ]
          }
        ]
      }
    ]
  end
end
