Class: Google::Apis::FirebaserulesV1::TestCase

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/firebaserules_v1/classes.rb,
generated/google/apis/firebaserules_v1/representations.rb,
generated/google/apis/firebaserules_v1/representations.rb

Overview

TestCase messages provide the request context and an expectation as to whether the given context will be allowed or denied. Test cases may specify the request, resource, and function_mocks to mock a function call to a service-provided function. The request object represents context present at request-time. The resource is the value of the target resource as it appears in persistent storage before the request is executed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ TestCase

Returns a new instance of TestCase



513
514
515
# File 'generated/google/apis/firebaserules_v1/classes.rb', line 513

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#expectationString

Test expectation. Corresponds to the JSON property expectation

Returns:

  • (String)


491
492
493
# File 'generated/google/apis/firebaserules_v1/classes.rb', line 491

def expectation
  @expectation
end

#function_mocksArray<Google::Apis::FirebaserulesV1::FunctionMock>

Optional function mocks for service-defined functions. If not set, any service defined function is expected to return an error, which may or may not influence the test outcome. Corresponds to the JSON property functionMocks



486
487
488
# File 'generated/google/apis/firebaserules_v1/classes.rb', line 486

def function_mocks
  @function_mocks
end

#requestObject

Request context. The exact format of the request context is service-dependent. See the appropriate service documentation for information about the supported fields and types on the request. Minimally, all services support the following fields and types: Request field | Type ---------------|----------------- auth.uid | string auth.token | map<string, string> headers | map<string, string> method | string params | map<string, string> path | string time | google.protobuf.Timestamp If the request value is not well-formed for the service, the request will be rejected as an invalid argument. Corresponds to the JSON property request

Returns:

  • (Object)


511
512
513
# File 'generated/google/apis/firebaserules_v1/classes.rb', line 511

def request
  @request
end

#resourceObject

Optional resource value as it appears in persistent storage before the request is fulfilled. The resource type depends on the request.path value. Corresponds to the JSON property resource

Returns:

  • (Object)


479
480
481
# File 'generated/google/apis/firebaserules_v1/classes.rb', line 479

def resource
  @resource
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



518
519
520
521
522
523
# File 'generated/google/apis/firebaserules_v1/classes.rb', line 518

def update!(**args)
  @resource = args[:resource] if args.key?(:resource)
  @function_mocks = args[:function_mocks] if args.key?(:function_mocks)
  @expectation = args[:expectation] if args.key?(:expectation)
  @request = args[:request] if args.key?(:request)
end