Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
add record add command unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmostafa committed Jun 3, 2021
1 parent 4f4c42e commit cf65bd1
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions tests/dmcli/groups/test_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,34 @@ def test_record_get_command(mocker):
assert result.output.splitlines()[0] == "Domain: example.com"


# def test_record_add_command():
# """Test `dmcli record add`."""
# runner = CliRunner()
# result = runner.invoke(record)
def test_record_add_command(mocker):
"""Test `dmcli record add`."""
mocker.patch(
"dmcli.utils.api.get",
return_value=[{"name": "example.com"}],
)
mocker.patch(
"dmcli.utils.api.post",
return_value="Record Successfully Added",
)
runner = CliRunner()
result = runner.invoke(
record,
"add",
input="\n".join(
["example.com", "sub.example.com", "A", "60", "https", "10.20.3.40"]
),
)

# assert (
# result.output.splitlines()[0] == "Usage: record [OPTIONS] COMMAND [ARGS]..."
# ), "base record command not outputting usage."
assert result.output.splitlines()[0] == "Domain name: example.com"
assert (
result.output.splitlines()[1]
== "Record name [example.domain.com]: sub.example.com"
)
assert (
result.output.splitlines()[2]
== "Record type (A, AAAA, CNAME, MX, NS, PTR, SRV, TXT, REDIRECT): A"
)


# def test_record_delete_command():
Expand Down

0 comments on commit cf65bd1

Please sign in to comment.