Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-adapter-javascript
Commits
11225b04
Unverified
Commit
11225b04
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
refactor: remove committed testsuite files
parent
320991b4
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
5 additions
and
266 deletions
+5
-266
.gitignore
.gitignore
+5
-0
features/adapter_auth.feature
features/adapter_auth.feature
+0
-13
features/adapter_broadcast.feature
features/adapter_broadcast.feature
+0
-18
features/adapter_get-authorization-header.feature
features/adapter_get-authorization-header.feature
+0
-21
features/adapter_poll.feature
features/adapter_poll.feature
+0
-42
features/adapter_publish.feature
features/adapter_publish.feature
+0
-18
features/adapter_token-valid.feature
features/adapter_token-valid.feature
+0
-21
features/adapter_validate.feature
features/adapter_validate.feature
+0
-16
features/protocol_decode.feature
features/protocol_decode.feature
+0
-11
features/protocol_encode.feature
features/protocol_encode.feature
+0
-11
features/protocol_get-type.feature
features/protocol_get-type.feature
+0
-12
features/protocol_validate.feature
features/protocol_validate.feature
+0
-12
features/schema_validate.feature
features/schema_validate.feature
+0
-10
test/fixtures/config-invalid.json
test/fixtures/config-invalid.json
+0
-7
test/fixtures/config-valid.json
test/fixtures/config-valid.json
+0
-7
test/fixtures/message-vehicle-status-invalid.json
test/fixtures/message-vehicle-status-invalid.json
+0
-20
test/fixtures/message-vehicle-status.json
test/fixtures/message-vehicle-status.json
+0
-20
test/fixtures/response-denied-token.json
test/fixtures/response-denied-token.json
+0
-3
test/fixtures/response-valid-token.json
test/fixtures/response-valid-token.json
+0
-4
No files found.
.gitignore
View file @
11225b04
...
...
@@ -55,3 +55,8 @@ node_modules/
# Vim swap files
*.swp
# backbone-adapter-testsuite
test/features/*.feature
test/fixtures/*.json
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/adapter_auth.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Does the adapter authenticate?
When an adapter instance is created it authenticates and receives a token
Scenario
:
A
token is granted with valid config
Given
valid config
When
the adapter instance is created
When
the auth method is called
Then
the adapter credentials are populated
Scenario
:
Auth fails with invalid config
Given
invalid config
When
the adapter instance is created
Then
the adapter auth fails
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/adapter_broadcast.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Can the adapter broadcast messages?
The adapter publish method works as expected
Scenario
:
A
message can be published successfully
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock notify API response is configured to return success
When
the broadcast method is called
Then
a successful response is returned with status 200
Scenario
:
A
failed publish returns a 403
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock notify API response is configured to return an error
When
the broadcast method is called
Then
an error response is returned with status 403
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/adapter_get-authorization-header.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Can the adapter create an authorization header?
The adapter getAuthorizationHeader method works as expected
Scenario
:
getAuthorizationHeader returns a bearer token
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
the getAuthorizationHeader method is called
Then
a headers object is returned containing a bearer token authorization header
Scenario
:
getAuthorizationHeader implicitly calls auth if required
Given
valid config
When
the adapter instance is created
When
the getAuthorizationHeader method is called
Then
a headers object is returned containing a bearer token authorization header
Scenario
:
getAuthorizationHeader implicitly calls auth if required
Given
invalid config
When
the adapter instance is created
When
the getAuthorizationHeader method is called
Then
an error response is returned with status 403
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/adapter_poll.feature
deleted
100644 → 0
View file @
320991b4
# When the queue contains x messages
# only mocks the API response
# Testing how the API behaves with a full queue are defined in the API
Feature
:
Can the adapter receive messages?
The adapter poll method works as expected
Scenario
:
No
messages are received succecssfully if the queue is empty
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return 0 messages
When
the poll method is called
Then
a successful response is returned with 0 messages
Scenario
:
2 messages are received succecssfully if the queue contains 2 messages
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return 2 messages
When
the poll method is called
Then
a successful response is returned with 2 messages
Then
the protocol
"validate"
method is called 2 times
Then
the protocol
"decode"
method is called 2 times
Scenario
:
10 messages are received succecssfully if the queue contains 10 messages
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return 10 messages
When
the poll method is called
Then
a successful response is returned with 10 messages
Then
the protocol
"validate"
method is called 10 times
Then
the protocol
"decode"
method is called 10 times
Scenario
:
An
invalid token returns a forbidden response
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock receive API response is configured to return an error
When
the poll method is called
Then
an error response is returned with status 403
This diff is collapsed.
Click to expand it.
features/adapter_publish.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Can the adapter publish messages?
The adapter publish method works as expected
Scenario
:
A
message can be published successfully
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock send API response is configured to return success
When
the publish method is called
Then
a successful response is returned with status 200
Scenario
:
A
failed publish returns a 403
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
a mock send API response is configured to return an error
When
the publish method is called
Then
an error response is returned with status 403
This diff is collapsed.
Click to expand it.
features/adapter_token-valid.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Is the token valid?
The adapter tokenValid method works as expected
Scenario
:
If adapter has not authed token is invalid
Given
valid config
When
the adapter instance is created
Then
tokenValid returns false
Scenario
:
If credentials.expiry is in the future token is valid
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
the token expiry is in the future
Then
tokenValid returns true
Scenario
:
If credentials.expiry is in the past token is invalid
Given
valid config
When
the adapter instance is created
When
the auth method is called
When
the token expiry is in the past
Then
tokenValid returns false
This diff is collapsed.
Click to expand it.
features/adapter_validate.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Can the adapter validate messages?
The adapter validate method works as expected
Scenario
:
A
valid message is successfully validated against the protocol schema
Given
valid config
Given
a valid message
When
the adapter instance is created
When
the validate method is called
Then
the message is validated successfully
Scenario
:
An
invalid message fails to validate against the protocol schema
Given
valid config
Given
an invalid message
When
the adapter instance is created
When
the validate method is called
Then
the message fails to validate
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/protocol_decode.feature
deleted
100644 → 0
View file @
320991b4
# Decode and encode are provided as stubs which are intended to be overridden
# These can be used to translate the message or to invoke other functions
# to take action based on the type and content of messages
Feature
:
Decode stubs passthru message unchanged
The protocol decode method works as expected
Scenario
:
Decode passes the message through unaltered
Given
a valid message
When
the protocol.decode method is called
Then
the message is returned unaltered
This diff is collapsed.
Click to expand it.
features/protocol_encode.feature
deleted
100644 → 0
View file @
320991b4
# Decode and encode are provided as stubs which are intended to be overridden
# These can be used to translate the message or to invoke other functions
# to take action based on the type and content of messages
Feature
:
Encode stubs passthru message unchanged
The protocol encode method works as expected
Scenario
:
Encode passes the message through unaltered
Given
a valid message
When
the protocol.encode method is called
Then
the message is returned unaltered
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/protocol_get-type.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Can the protocol determine message type
The protocol getType method works as expected
Scenario
:
A
valid message is successfully typed
Given
a valid message
When
protocol getType is called
Then
getType returns message.payload.message_type if present
Scenario
:
An invalid message returns type
:
null
Given
an invalid message
When
protocol getType is called
Then
getType returns null if message.payload.message_type is not present
This diff is collapsed.
Click to expand it.
features/protocol_validate.feature
deleted
100644 → 0
View file @
320991b4
Feature
:
Can the protocol validate messages?
The adapter validate method works as expected
Scenario
:
A
valid message is successfully validated against the protocol schema
Given
a valid message
When
the protocol.validate method is called
Then
the message is validated successfully
Scenario
:
An
invalid message fails to validate against the protocol schema
Given
an invalid message
When
the protocol.validate method is called
Then
the message fails to validate
\ No newline at end of file
This diff is collapsed.
Click to expand it.
features/schema_validate.feature
deleted
100644 → 0
View file @
320991b4
# If the mock schema fixture fails to validate
# it can cause invalid messages to show as valid
Feature
:
Is the mock schema valid?
The mock schema must validate in order for the adapter test to work
Scenario
:
The schema matches the OpenAPI specification
Given
the test schema
When
it is validated
Then
it matches the OpenAPI specification
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/config-invalid.json
deleted
100644 → 0
View file @
320991b4
{
"api"
:
"https://example.backbone.com/api"
,
"client_id"
:
"invalid-client-id"
,
"client_name"
:
"InvalidClientName"
,
"subscription"
:
"dot.delimited.topic.subscription.#"
,
"secret"
:
"TheCollaredDoveCoosInTheChimneyPot"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/config-valid.json
deleted
100644 → 0
View file @
320991b4
{
"api"
:
"https://example.backbone.com/api"
,
"client_id"
:
"unique-client-id"
,
"client_name"
:
"UniqueClientName"
,
"subscription"
:
"dot.delimited.topic.subscription.#"
,
"secret"
:
"TheGeeseFlySouthInWinter"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/message-vehicle-status-invalid.json
deleted
100644 → 0
View file @
320991b4
{
"metadata"
:
{
"source"
:
"ae"
,
"destination"
:
"soar.po.ecosub.eco1"
,
"delivery_type"
:
"publish"
,
"message_id"
:
"test"
},
"payload"
:
{
"messagetype"
:
"VehicleStatus"
,
"operatorID"
:
1
,
"vehicleID"
:
12
,
"coordinates"
:
{
"latitude"
:
"monkeys"
,
"longitude"
:
"janvier"
,
"depth"
:
"twenty five metres please"
,
"projection"
:
4326
},
"battery_percentage"
:
"plenty"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/message-vehicle-status.json
deleted
100644 → 0
View file @
320991b4
{
"metadata"
:
{
"source"
:
"ae"
,
"destination"
:
"soar.po.ecosub.eco1"
,
"delivery_type"
:
"publish"
,
"message_id"
:
"test"
},
"payload"
:
{
"message_type"
:
"VehicleStatus"
,
"operator_id"
:
"po"
,
"vehicle_id"
:
"eco1"
,
"coordinates"
:
{
"latitude"
:
57.234
,
"longitude"
:
-8.432
,
"depth"
:
50
,
"projection"
:
4326
},
"battery_percentage"
:
64
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/response-denied-token.json
deleted
100644 → 0
View file @
320991b4
{
"message"
:
"Invalid client credentials"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/response-valid-token.json
deleted
100644 → 0
View file @
320991b4
{
"token"
:
"gAAAAABjwB-vxtER44M2en6xYyt7G1WXp8QwfsiHw-ijCqNBZpQPwxxrBHzUU1fQ9lfPPo4QHj50p-yh203dV6zLLoTzuiReqGzE2InqAxOwv4gddlQWNFJKyrmg4mVVMX2VZe2cCAljmHxEo66BHgt_T24AieedMnI4VR2kw4SFiooFv5nr2W8="
,
"expiry"
:
"2030-12-31T23:59:59.000000"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment