def test_types(self): one_to_one_schema = self.schema.children.get(self.one_to_one_name) self.assertEqual(one_to_one_schema.types[0], types.UUID()) one_to_many_schema = self.schema.children.get(self.one_to_many_name) self.assertEqual(one_to_many_schema.types[0], types.ARRAY()) many_to_many_schema = self.schema.children.get(self.many_to_many_name) self.assertEqual(many_to_many_schema.types[0], types.ARRAY()) many_to_one_schema = self.schema.children.get(self.many_to_one_name) self.assertEqual(many_to_one_schema.types[0], types.UUID())
def __init__(self, response=WithChallengeClientResponse, children=None, **kwargs): super().__init__( **kwargs, description=('The result of a challenge-blocked method.' ' Contains information relevant to the open challenge' ' needed to complete the method execution.'), response=response, children=merge( { with_challenge_constants.CHALLENGE_COMPLETE: Schema( description= 'A flag indicating whether the challenge is complete', types=types.BOOLEAN(), ), with_challenge_constants.OPEN_CHALLENGE_ID: Schema( description='The ID of the open challenge', types=types.UUID(), ), }, children, ), )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, response=PrototypeResponse, types=types.UUID(), )
def __init__(self, **kwargs): super().__init__(**kwargs) self.children = { proxy_constants.ID: Schema(types=types.UUID()), proxy_constants.IP: Schema(), proxy_constants.CHANNEL: Schema(), proxy_constants.TRANSACTINO: Schema(types=types.ANY()), }
def setUp(self): self.test_key = 'test_key' self.schema = StructureSchema(children={ self.test_key: Schema( types=types.UUID(), response=PropertyResponse, ), }, )
def __init__(self, Model): self.model = Model super().__init__( origin=lock_constants.ORIGIN, response=AccountSuperadminLockResponse, children={ lock_constants.LOCK: Schema(types=types.BOOLEAN()), lock_constants.ACCOUNT_ID: Schema(types=types.UUID()), }, )
def __init__(self, **kwargs): super().__init__( **kwargs, description=('The schema for the Challenge delete method.'), children={ delete_constants.CHALLENGE_ID: Schema( description=('The challenge ID to delete'), types=types.UUID(), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=( 'The schema for the TransactionMatch get method.' ' Basic filters are available for the ID and' ' active status of the TransactionMatch.' ), response=TransactionMatchGetResponse, children={ get_constants.TRANSACTION_REPORT_ID: Schema( description='Filter by the ID of the parent TransactionReport.', types=types.UUID(), ), get_constants.TRANSACTION_REPORT_TARGET_ADDRESS: Schema( description='Filter by the target address of the parent TransactionReport.', ), get_constants.TRANSACTION_REPORT_IS_ACTIVE: Schema( description='Filter by the active status of the parent TransactionReport.', types=types.BOOLEAN(), ), get_constants.TRANSACTION_MATCH_ID: Schema( description=( 'The ID of the TransactionMatch in question. This value' ' will override any filters applied.' ), types=types.UUID(), ), transaction_match_fields.IS_NEW: Schema( description=( 'Filter by the new status of the TransactionMatch.' ), types=types.BOOLEAN(), ), transaction_match_fields.BLOCK_HASH: Schema( description='Filter by the block hash of the TransactionMatch.', ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=('The schema for the Address get method.'), response=AddressGetResponse, children={ get_constants.ADDRESS_ID: Schema( description='The address ID', types=types.UUID(), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=( 'The schema for the IP delete method.' ), origin=delete_constants.ORIGIN, response=IPDeleteResponse, children={ delete_constants.IP_ID: Schema( description='The IP address ID', types=types.UUID(), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=('The schema for the FeeReport delete method. The' ' value given to this function is the ID of the' ' FeeReport to delete.'), response=FeeReportDeleteResponse, origin=delete_constants.ORIGIN, children={ delete_constants.FEE_REPORT_ID: Schema( description=('The ID of the FeeReport object to delete.'), types=types.UUID(), ), }, )
def __init__(self, response=WithPaymentClientResponse, children=None, **kwargs): super().__init__( **kwargs, response=response, children=merge( { with_payment_constants.PAYMENT_COMPLETE: Schema(types=types.BOOLEAN()), with_payment_constants.OPEN_PAYMENT_ID: Schema(types=types.UUID()), }, children, ), )
def __init__(self, Model, mode=None, **kwargs): super().__init__(**kwargs) self.non_nullable = { relationship.name for relationship in Model.objects.relationships(mode=mode) if (relationship.editable and not relationship.has_default() and not relationship.null and not relationship.one_to_many and not relationship.many_to_many) } self.children = { relationship.name: Schema( description=relationship.name, types=(types.UUID() if relationship.one_to_one or relationship.many_to_one else types.ARRAY()), ) for relationship in Model.objects.relationships(mode=mode) if relationship.editable }
def __init__(self, relationship, **kwargs): self.relationship = relationship if relationship.one_to_one or relationship.many_to_one: relationship_schema_types = [types.UUID()] if relationship.null: relationship_schema_types.append( types.STRUCTURE(schema=NullableSchema(relationship), ), ) else: relationship_schema_types = types.STRUCTURE( schema=RelationshipManySchema(relationship), ) super().__init__( **kwargs, description=relationship.name, response=PropertyResponse, types=relationship_schema_types, )
def __init__(self, **kwargs): super().__init__( **kwargs, description=('The schema for the challenge result. Contains the' ' outcome of the evaluation.'), children={ respond_constants.CHALLENGE_ID: Schema( description= 'The ID of the Challenge that is in the process of being verified', types=types.UUID(), ), respond_constants.IS_VERIFIED: Schema( description= 'A flag indicating whether the verification has been successful', types=types.BOOLEAN(), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=( 'The schema for the IP get method. IP addresses can be fetched by' ' their ID. The default behaviour if no ID is included is to return' ' all IP addresses bound to this account.' ), origin=get_constants.ORIGIN, response=IPGetResponse, children={ get_constants.IP_ID: Schema( description=( 'The IP address ID' ), types=types.UUID(), ), }, )
def __init__(self, **kwargs): super().__init__( **kwargs, description=( 'The schema for the Payment get method.' ' It can be filtered by the open status of' ' the payment and the payment ID' ), response=PaymentGetResponse, children={ get_constants.PAYMENT_ID: Schema( description='The payment ID', types=types.UUID(), ), payment_fields.IS_OPEN: Schema( description='The payment open status', types=types.BOOLEAN(), ), }, )
def __init__(self, **kwargs): super().__init__( **kwargs, description=( 'The schema for the Challenge respond method.' ' Processes a request based on the ID of the challenge,' ' returning the result of the challenge evaluation.'), client=ChallengeRespondClientSchema(), children={ respond_constants.CHALLENGE_ID: Schema( description='The ID of the challenge in question', types=types.UUID(), ), respond_constants.CONTENT: Schema(description=( 'The decrypted text of the challenge,' ' having been re-encrypted to the public' ' key of the service and put into ascii armor format.'), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=('The schema for the FeeReport activate method.'), response=FeeReportActivateResponse, origin=activate_constants.ORIGIN, children={ activate_constants.FEE_REPORT_ID: Schema( description='The ID of the FeeReport is question.', types=types.UUID(), ), fee_report_fields.IS_ACTIVE: Schema( description=('A boolean value that designates whether' ' the report should be active.'), types=types.BOOLEAN(), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=('The schema for the FeeReport get method.' ' Basic filters are available for the ID and' ' active status of the FeeReport.'), response=FeeReportGetResponse, children={ get_constants.FEE_REPORT_ID: Schema( description='The ID of the FeeReport in question.', types=types.UUID(), ), fee_report_fields.IS_ACTIVE: Schema( description='The active status of the FeeReport.', types=types.BOOLEAN(), ), }, )
def __init__(self, **kwargs): super().__init__( **kwargs, description=('The schema for the Challenge get method.' ' Returns instances of the Challenge class and' ' includes a simple filter for the open status' ' of each object.'), response=ChallengeGetResponse, children={ get_constants.CHALLENGE_ID: Schema( description=('The challenge ID'), types=types.UUID(), ), challenge_fields.IS_OPEN: Schema( description=('Filter the list of challenges' ' by their open states.'), types=types.BOOLEAN(), ), }, )
def __init__(self, Model, **kwargs): self.model = Model super().__init__( **kwargs, description=( 'The schema for the TransactionReport delete method. The' ' value given to this function is the ID of the' ' TransactionReport to delete. WARNING: successful execution' ' of this function will also cause all related TransactionMatch' ' objects to be deleted.' ), response=TransactionReportDeleteResponse, origin=delete_constants.ORIGIN, children={ delete_constants.TRANSACTION_REPORT_ID: Schema( description=( 'The ID of the TransactionReport object to delete.' ), types=types.UUID(), ), }, )
def __init__(self, **kwargs): super().__init__( **kwargs, description=('The schema for the Subscription get method.' ' Filters can be applied for the active status' ' and the ID of the subscription.'), response=SubscriptionGetResponse, children={ get_constants.SUBSCRIPTION_ID: Schema( description=('The subscription ID'), types=types.UUID(), ), subscription_fields.IS_ACTIVE: Schema( description= ('The subscription active status. If omitted, all subscriptions' ' are returned.'), types=types.BOOLEAN(), ), }, )
def __init__(self, **kwargs): super().__init__( **kwargs, template=TemplateSchema(types=types.UUID()), )
def test_non_nullable_relationship_schema_types(self): self.assertEqual(self.non_nullable_relationship_schema.types, [types.UUID()])
def test_nullable_relationship_schema_types(self): self.assertEqual(self.nullable_relationship_schema.types, [ types.UUID(), types.STRUCTURE(), ])
def __init__(self, relationship, **kwargs): self.relationship = relationship super().__init__( **kwargs, types=types.UUID(), )
def __init__(self, **kwargs): super().__init__( **kwargs, response=CreateClientResponse, template=TemplateSchema(types=types.UUID()), )