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

Initial Test Definitions for DeviceIdentifier retrieve identifier #72

Merged
merged 35 commits into from
Sep 23, 2024
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4d63f29
Initial Test Definitions for DeviceIdentifier_retrieve_identifier.yaml
AxelNennker Aug 5, 2024
a1e7755
remove too many blank lines
AxelNennker Aug 5, 2024
8a18ed5
remove trailing spaces
AxelNennker Aug 5, 2024
9f8e39d
renamed file
AxelNennker Aug 5, 2024
db60451
fix response property
AxelNennker Aug 5, 2024
6b89d89
fix response property imeisv
AxelNennker Aug 5, 2024
bf6ce7b
remove NV section Update DeviceIdentifier_retrieve_identifier.feature
AxelNennker Aug 5, 2024
2fcc344
remove duplicate line Update DeviceIdentifier_retrieve_identifier.fea…
AxelNennker Aug 5, 2024
1aea360
remove OIDC authorization code Update DeviceIdentifier_retrieve_ident…
AxelNennker Aug 5, 2024
2ef0b38
fix response property imeisv Update code/Test_definitions/DeviceIdent…
AxelNennker Aug 5, 2024
a685904
fix DeviceIpv4Address Update DeviceIdentifier_retrieve_identifier.fea…
AxelNennker Aug 5, 2024
1e5819b
fix ipv4 request body Update code/Test_definitions/DeviceIdentifier_r…
AxelNennker Aug 5, 2024
3cd1324
different SIMs in same slot in same device yield same device identifi…
AxelNennker Aug 15, 2024
0322fe5
SIMCARD[1|2] <-> PHONENUMBER[1|2]
AxelNennker Aug 16, 2024
0b8da5d
vwip
AxelNennker Aug 20, 2024
10b3d59
pattern instead of schema
AxelNennker Aug 20, 2024
fd3aea8
Then first
AxelNennker Aug 20, 2024
a0e1dd7
typo
AxelNennker Aug 20, 2024
51ce034
name devices
AxelNennker Aug 20, 2024
b8eee73
Then first
AxelNennker Aug 20, 2024
20e17b2
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
AxelNennker Aug 20, 2024
b2444be
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
2f14aa1
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
17ee390
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
8f0b213
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
e3bc76e
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
4ed9766
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
300ccb4
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
e6c28b9
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
bfbfcc3
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
30d2336
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
6f3d5b5
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
bf9176e
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
ecb4d81
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
a18cd63
Update code/Test_definitions/DeviceIdentifier_retrieve_identifier.fea…
eric-murray Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions code/Test_definitions/DeviceIdentifier_retrieve_identifier.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
@DeviceIdentifier_retrieve_identifier
Feature: Camara Device Identifer API retrieve identifier

# Input to be provided by the implementation to the tests
# References to OAS spec schemas refer to schemas specified in code/API_definitions/CAMARA Mobile Device Identifier API.yaml
# Implementation indications:
# * api_root: API root of the server URL
#
# Testing assets:
# * a mobile device DEVICE1 with IMEI IMEI1, and IMEISV IMEISV1
# * a mobile device DEVICE2 with IMEI IMEI2, IMEISV IMEISV2, public IPv4 address PUBLICIPV4ADDRESS, and public port PUBLICPORT
# * a SIM card SIMCARD1 by telco1 and phone number PHONENUMBER1
# * a SIM card SIMCARD2 by telco2 and phone number PHONENUMBER2

Background: Common Device Identifier retrieve identifer setup
Given the resource "/retrieve-identifier/vwip" as base url
And the header "Content-Type" is set to "application/json"
And the header "Authorization" is set to a valid access token
And the header "x-correlator" is set to a UUID value
And the request body is compliant with the schema Device

@DeviceIdentifier_retrieve_identifier0_phoneNumber_does_not_match_schema
Scenario Outline: phoneNumber value does not comply with the defined pattern
Given the request body property "$.phoneNumber" is set to: <phone_number_value>
When the HTTP "POST" request is sent
Then the response status code is 400
And the response property "$.status" is 400
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

Examples:
| phone_number_value |
| string_value |
| 1234567890 |
| +12334foo22222 |
| +00012230304913849 |
| 123 |
| ++49565456787 |

@DeviceIdentifier_retrieve_identifier100_success
Scenario: retrieve device identifier for phone number PHONENUMBER1, network connection, and access token matches PHONENUMBER1
Given SIMCARD1 is installed within DEVICE1, which is connected to the network
And the correct base url for the API provider is used
And the resource is "/retrieve-identifier"
And one of the scopes associated with the access token is device-identifier:retrieve-identifier
When the HTTPS "POST" request is sent
And the request body has the field phoneNumber with a value of PHONENUMBER1
Then the response status code is 200
And the response body complies with the OAS schema at "/components/schemas/200RetrieveIdentifier"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response header "Content-Type" is "application/json"
And the response property "$.imei" is IMEI1

@DeviceIdentifier_retrieve_identifier101_success
Scenario: retrieve device identifier for phone number PHONENUMBER2, network connection, and access token matches PHONENUMBER2
Given SIMCARD2 is installed within DEVICE2, which is connected to the network
And the correct base url for the API provider is used
And the API provider supports responding with the IMEISV of the identified device
And the resource is "/retrieve-identifier"
And one of the scopes associated with the access token is device-identifier:retrieve-identifier
When the HTTPS "POST" request is sent
And the request body has the field phoneNumber with a value of PHONENUMBER2
Then the response status code is 200
And the response body complies with the OAS schema at "/components/schemas/200RetrieveIdentifier"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response header "Content-Type" is "application/json"
And the response property "$.imeisv" is IMEISV2
And the response property "$.imei" is IMEI2

@DeviceIdentifier_retrieve_identifier103_same_device_different_SIMs
Scenario: retrieve device identifer on the same device but for different SIMs by different telcos. The device identifier MUST be the same.
Given the correct base url for the API provider is used
And the resource is "/retrieve-identifier"
And one of the scopes associated with the access token is device-identifier:retrieve-identifier
When a device_identifier1 is retrieved on the device with SIMCARD1 in slot1
And a device_identifier2 is retrieved on the same device with SIMCARD2 in slot1
Then device_identifier1 and device_identifier2 are equal


@DeviceIdentifier_retrieve_identifier102_ipv4Address_success
Scenario: retrieve device identifier for phone number PHONENUMBER2, network connection, and access token matches PHONENUMBER2
Given SIMCARD2 is installed within DEVICE2, which is connected to the network
And the correct base url for the API provider is used
And the API provider supports responding with the IMEISV of the identified device
And the resource is "/retrieve-identifier"
And one of the scopes associated with the access token is device-identifier:retrieve-identifier
When the HTTPS "POST" request is sent
And the request body has the field ipv4Address.publicAddress with a value of PUBLICIPV4ADDRESS
And the request body has the field ipv4Address.publicPort with a value of PUBLICPORT
Then the response status code is 200
And the response body complies with the OAS schema at "/components/schemas/200RetrieveIdentifier"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response header "Content-Type" is "application/json"
And the response property "$.imeisv" is IMEISV2
And the response property "$.imei" is IMEI

@DeviceIdentifier_retrieve_identifier200_missing_device_information
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just testing that an empty request body is caught by the API provider schema validation is not so interesting. Interesting tests are:

  • 2-legged token, but no request body
  • 3-legged token, but also request body identifying a device
    I updated the test definition here for the first of these cases.

Scenario: retrieve identifier but 2-legged access token used and no device information in request
Given the correct base url for the API provider is used
And the resource is "/retrieve-identifier"
And a 2-legged access token is used
And one of the scopes associated with the access token is device-identifier:retrieve-identifier
eric-murray marked this conversation as resolved.
Show resolved Hide resolved
When the HTTPS "POST" request is sent
And the connection the request is sent over originates from a device with PHONENUMBER1
And there is no request body
Then the response status code is 400
And the response body complies with the OAS schema at "/components/schemas/ErrorResponse"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response header "Content-Type" is "application/json"
And the response property "$.status" is 404
And the response property "$.code" is "DEVICE_NOT_FOUND"
And the response property "$.message" contains a user friendly text

@DeviceIdentifier_retrieve_identifier201_missing_scope
Scenario: retrieve device identifier with valid access token but scope device-identifier:retrieve-identifier is missing
Given the correct base url for the API provider is used
And the resource is "/retrieve-identifier"
And none of the scopes associated with the access token is device-identifier:retrieve-identifier
When the HTTPS "POST" request is sent
And the connection the request is sent over originates from a device with PHONENUMBER1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this line in for now, but I don't think this affects the test in any way other than to complicate it. What matters is how the access token is obtained.

This device itself could use client credentials if allowed by regulation, or it could use CIBA if no server involved, or it could use authorisation code flow if a server sent it an appropriate re-direct (in which case, the API call itself would be made by that server and not the device).

All of these options (2-legged token, or 3-legged token obtained using CIBA or authorisation code flow) are also available to a server.

And the request body has the field phoneNumber with a value of PHONENUMBER1
Then the response status code is 401
And the response body complies with the OAS schema at "/components/schemas/ErrorResponse"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response header "Content-Type" is "application/json"
And the response property "$.status" is 401
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" is "Request not authenticated due to missing, invalid, or expired credentials."

@DeviceIdentifier_retrieve_identifier202_expired_access_token
Scenario: retrieve device identifier with expired access token
Given the correct base url for the API provider is used
And the resource is "/retrieve-identifier"
And one of the scopes associated with the access token is device-identifier:retrieve-identifier
And the access token has expired
When the HTTPS "POST" request is sent
And the connection the request is sent over originates from a device with PHONENUMBER1
And the request body has the field phoneNumber with a value of PHONENUMBER1
Then the response status code is 401
And the response body complies with the OAS schema at "/components/schemas/ErrorResponse"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response header "Content-Type" is "application/json"
And the response property "$.status" is 401
And the response property "$.code" is "AUTHENTICATION_REQUIRED"
And the response property "$.message" is "New authentication is required."