-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix - replace Assert type of response actions by enum.
* Fix - replace Log type of response actions by enum. * Fix - replace ExtractJson type of response actions by enum.
- Loading branch information
1 parent
c203ab6
commit 2e251ae
Showing
11 changed files
with
246 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...Api/src/main/scala/africa/absa/testing/scapi/rest/response/AssertResponseActionType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2023 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package africa.absa.testing.scapi.rest.response | ||
|
||
import africa.absa.testing.scapi.rest.response | ||
|
||
import scala.language.implicitConversions | ||
|
||
object AssertResponseActionType extends Enumeration { | ||
type AssertResponseActionType = Value | ||
|
||
// response-time-... | ||
val RESPONSE_TIME_IS_BELOW: response.AssertResponseActionType.Value = Value("response-time-is-below") | ||
val RESPONSE_TIME_IS_ABOVE: response.AssertResponseActionType.Value = Value("response-time-is-above") | ||
|
||
// status-code-... | ||
val STATUS_CODE_EQUALS: response.AssertResponseActionType.Value = Value("status-code-equals") | ||
val STATUS_CODE_IS_SUCCESS: response.AssertResponseActionType.Value = Value("status-code-is-success") | ||
val STATUS_CODE_IS_CLIENT_ERROR: response.AssertResponseActionType.Value = Value("status-code-is-client-error") | ||
val STATUS_CODE_IS_SERVER_ERROR: response.AssertResponseActionType.Value = Value("status-code-is-server-error") | ||
|
||
// header-... | ||
val HEADER_EXISTS: response.AssertResponseActionType.Value = Value("header-exists") | ||
val HEADER_VALUE_EQUALS: response.AssertResponseActionType.Value = Value("header-value-equals") | ||
|
||
// content-type-... | ||
val CONTENT_TYPE_IS_JSON: response.AssertResponseActionType.Value = Value("content-type-is-json") | ||
val CONTENT_TYPE_IS_XML: response.AssertResponseActionType.Value = Value("content-type-is-xml") | ||
val CONTENT_TYPE_IS_HTML: response.AssertResponseActionType.Value = Value("content-type-is-html") | ||
|
||
// cookies-... | ||
val COOKIE_EXISTS: response.AssertResponseActionType.Value = Value("cookie-exists") | ||
val COOKIE_VALUE_EQUALS: response.AssertResponseActionType.Value = Value("cookie-value-equals") | ||
val COOKIE_IS_SECURED: response.AssertResponseActionType.Value = Value("cookie-is-secured") | ||
val COOKIE_IS_NOT_SECURED: response.AssertResponseActionType.Value = Value("cookie-is-not-secured") | ||
|
||
// body-... | ||
val BODY_CONTAINS_TEXT: response.AssertResponseActionType.Value = Value("body-contains-text") | ||
|
||
private val stringToValueMap = values.map(v => v.toString -> v).toMap | ||
|
||
def fromString(s: String): Option[AssertResponseActionType] = stringToValueMap.get(s) | ||
|
||
// Implicit conversion from AssertResponseActionType to String | ||
implicit def enumValueToString(value: AssertResponseActionType): String = value.toString | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rc/main/scala/africa/absa/testing/scapi/rest/response/ExtractJsonResponseActionType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2023 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package africa.absa.testing.scapi.rest.response | ||
|
||
import africa.absa.testing.scapi.rest.response | ||
|
||
import scala.language.implicitConversions | ||
|
||
object ExtractJsonResponseActionType extends Enumeration { | ||
type ExtractJsonResponseActionType = Value | ||
|
||
val STRING_FROM_LIST: response.ExtractJsonResponseActionType.Value = Value("string-from-list") | ||
|
||
private val stringToValueMap = values.map(v => v.toString -> v).toMap | ||
|
||
def fromString(s: String): Option[ExtractJsonResponseActionType] = stringToValueMap.get(s) | ||
|
||
// Implicit conversion from AssertResponseActionType to String | ||
implicit def enumValueToString(value: ExtractJsonResponseActionType): String = value.toString | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
testApi/src/main/scala/africa/absa/testing/scapi/rest/response/LogResponseActionType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2023 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package africa.absa.testing.scapi.rest.response | ||
|
||
import africa.absa.testing.scapi.rest.response | ||
|
||
import scala.language.implicitConversions | ||
|
||
object LogResponseActionType extends Enumeration { | ||
type LogResponseActionType = Value | ||
|
||
val ERROR: response.LogResponseActionType.Value = Value("error") | ||
val WARN: response.LogResponseActionType.Value = Value("warn") | ||
val INFO: response.LogResponseActionType.Value = Value("info") | ||
val DEBUG: response.LogResponseActionType.Value = Value("debug") | ||
|
||
private val stringToValueMap = values.map(v => v.toString -> v).toMap | ||
|
||
def fromString(s: String): Option[LogResponseActionType] = stringToValueMap.get(s) | ||
|
||
// Implicit conversion from AssertResponseActionType to String | ||
implicit def enumValueToString(value: LogResponseActionType): String = value.toString | ||
} |
Oops, something went wrong.