#!perl
use Cassandane::Tiny;

sub test_echo_tls
    :TLS :want_service_https :needs_component_httpd
{
    my ($self) = @_;

    my $jmap = $self->{jmap};

    # better be using https!
    $self->assert_str_equals('https', $jmap->{scheme});

    my $req = {
        hello => JSON::true,
        max => 5,
        stuff => { foo => "bar", empty => JSON::null }
    };

    xlog $self, "send ping";
    my $res = $jmap->CallMethods([['Core/echo', $req, "R1"]]);

    xlog $self, "check pong";
    $self->assert_not_null($res);
    $self->assert_str_equals('Core/echo', $res->[0][0]);
    $self->assert_deep_equals($req, $res->[0][1]);
    $self->assert_str_equals('R1', $res->[0][2]);
}
