JMAP-Tester

 view release on metacpan or  search on metacpan

lib/JMAP/Tester.pm  view on Meta::CPAN

#pod
#pod This method fetches the content at the authentication endpoint and uses it to
#pod configure the tester's target URIs and signing keys.
#pod
#pod This method respects the C<should_return_futures> attributes of the
#pod JMAP::Tester object, and in futures mode will return a future that will resolve
#pod to the Result.
#pod
#pod =cut

sub update_client_session ($self, $auth_uri = undef) {
  my $future = $self->_get_client_session_future($auth_uri)->then(sub {
    my ($auth) = @_;

    $self->configure_from_client_session($auth->client_session);

    return Future->done($auth);
  });

  return $self->should_return_futures ? $future : $future->$Failsafe->get;
}

lib/JMAP/Tester/Response/Sentence/Set.pm  view on Meta::CPAN

}

sub created_creation_ids ($self) {
  keys %{ $self->created }
}

sub created_ids ($self) {
  map {; $_->{id} } values %{ $self->created }
}

sub updated_ids ($self) {
  my $updated = $self->{arguments}{updated} // {};

  if (ref $updated eq 'ARRAY') {
    return @$updated;
  }

  return keys %$updated;
}

sub updated ($self) {
  my $updated = $self->{arguments}{updated} // {};

  if (ref $updated eq 'ARRAY') {
    return { map {; $_ => undef } @$updated };
  }

  return $updated;
}

sub destroyed_ids ($self) { @{ $self->{arguments}{destroyed} } }

# Is this the best API to provide?  I dunno, maybe.  Usage will tell us whether
# it's right. -- rjbs, 2016-04-11
sub not_created_ids   ($self) { keys %{ $self->{arguments}{notCreated} }   }
sub not_updated_ids   ($self) { keys %{ $self->{arguments}{notUpdated} }   }
sub not_destroyed_ids ($self) { keys %{ $self->{arguments}{notDestroyed} } }

sub create_errors     ($self) { $self->{arguments}{notCreated}   // {} }
sub update_errors     ($self) { $self->{arguments}{notUpdated}   // {} }
sub destroy_errors    ($self) { $self->{arguments}{notDestroyed} // {} }

sub assert_no_errors ($self) {
  my @errors;
  local $Data::Dumper::Terse = 1;

  if (keys %{ $self->create_errors }) {
    push @errors, "notCreated: " .  Data::Dumper::Dumper(
      $self->_strip_json_types( $self->create_errors )
    );



( run in 0.850 second using v1.01-cache-2.11-cpan-63428c044ed )