summaryrefslogtreecommitdiff
path: root/deps/rabbitmq_cli/test/ctl/list_hashes_command_test.exs
blob: 2869479a8a1fa57237bf307b668b0728a667af62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## This Source Code Form is subject to the terms of the Mozilla Public
## License, v. 2.0. If a copy of the MPL was not distributed with this
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
##
## Copyright (c) 2007-2020 VMware, Inc. or its affiliates.  All rights reserved.

defmodule ListHashesCommandTest do
  use ExUnit.Case
  @command RabbitMQ.CLI.Ctl.Commands.ListHashesCommand

  test "merge_defaults: nothing to do" do
    assert @command.merge_defaults([], %{}) == {[], %{}}
  end

  test "validate: treats positional arguments as a failure" do
    assert @command.validate(["extra-arg"], %{}) == {:validation_failure, :too_many_args}
  end

  test "validate: treats empty positional arguments and default switches as a success" do
    assert @command.validate([], %{}) == :ok
  end

  test "run: lists hashes", _context do
    assert match?(
      {:ok, _},
      @command.run([], %{})
    )
  end
end