Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue for fuzzy tests generation #464

Open
Kamigoro opened this issue Mar 1, 2023 · 2 comments
Open

Issue for fuzzy tests generation #464

Kamigoro opened this issue Mar 1, 2023 · 2 comments

Comments

@Kamigoro
Copy link

Kamigoro commented Mar 1, 2023

So I have this object definition, it has two possible definition for the property to.

type: object
properties:
  to:
    description: >
      The recipient of the push message.
      There is two way to contact a device, either to specify the device id or to give the device token and its provider.
      If the device token and the device id are specified, then the device token will be used.
    anyOf:
      - $ref: ./NotificationRecipientWithDeviceId.yaml
      - $ref: ./NotificationRecipientWithDeviceToken.yaml

Here are the definitions of the two references.

description: >
  The recipient of the push message.
  There is two way to contact a device, either to specify the device id or to give the device token and its provider.
  If the device token and the device id are specified, then the device token will be used.
type: object
properties:
  device_token:
    description: The unique device token
    type: string
    example: ed2576bfb93a2e7abc26fc3fc8b43399bb092a79e1db57e39a8bdaeeb6a3924a
  provider:
    $ref: ./Provider.yaml
required:
  - device_token
  - provider
description: >
  The recipient of the push message.
  There is two way to contact a device, either to specify the device id or to give the device token and its provider.
  If the device token and the device id are specified, then the device token will be used.
type: object
properties:
  device_id:
    description: The unique id of the device in SDC
    type: string
    example: a15e3ff0-fb5b-4026-a7d4-a65aa02bbfb8
required:
  - device_id

For the endpoint that uses it I give multiple examples, some with NotificationRecipientWithDeviceId and some with NotificationRecipientWithDeviceToken.
The problem is that when generating the fuzzing tests, Portman only uses the first example to generate its tests. In the first example I pass the property device_id and the test checking for the required property works, but the tests checking for the missing the required properties device_token and provider do not work because it uses the first example given, with the device_id in the body, which is a valid payload for us.

Payload generated for [Send push messages[Unprocessable][required [0].to.device_id]]
[
    {
        "reference": "newman{{$guid}}",
        "to": {}
    }
]
Payload generated for [Send push messages[Unprocessable][required [0].to.device_token]]
[
    {
        "reference": "newman{{$guid}}",
        "to": {
            "device_id": "a15e3ff0-fb5b-4026-a7d4-a65aa02bbfb8"
        }
    }
]

The payload that is expected for [Send push messages[Unprocessable][required [0].to.device_token]] would be either

[
    {
        "reference": "newman{{$guid}}",
        "to": {}
    }
]

OR

[
    {
        "reference": "newman{{$guid}}",
        "to": {
            "provider": "apple"
        }
    }
]

I think this issue is related to this one #191 in some ways.

@BenjaminDC
Copy link

I'm sure @thim81 can help us with this :p

@thim81
Copy link
Collaborator

thim81 commented Mar 10, 2023

hi @Kamigoro @BenjaminDC

Nice to hear from you.

The reported case is something that will require some more time to investigate.
I'll try to find some time and see what I can find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants