Skip to content

Commit

Permalink
Merge 8fbb4a9 into b7b7402
Browse files Browse the repository at this point in the history
  • Loading branch information
kolioOtSofia committed Jul 11, 2021
2 parents b7b7402 + 8fbb4a9 commit 435269e
Show file tree
Hide file tree
Showing 45 changed files with 130 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ requestOn: aString
on: Error
do: [ :error |
[ ATDDConnectionError signal: 'Connection failed: ' , error messageText ] fork.
^ JsonObject new ].
^ response code
= 200
^ nil ].
response code = 200
ifTrue: [
(response contentType includesSubstring: 'application/json')
ifTrue: [ ^ Json readFrom: response content readStream ].
Expand All @@ -24,4 +24,4 @@ requestOn: aString
]
ifFalse: [
self throwExceptionForResponseCode: response code.
JsonObject new ]
^ nil ]
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"getJsonForWorkflowRunsForRepository:" : "ng 5/22/2021 19:16",
"getLogsForRepository:logId:" : "BF 6/25/2021 17:13",
"mimeType" : "ng 5/14/2021 15:45",
"requestOn:" : "BF 6/26/2021 14:46" } }
"requestOn:" : "ng 7/9/2021 18:07" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
action
validate: aString

(aString matchesRegex: self class validSlug) ifFalse: [ ATDDNoValidSlugError signal ]
(aString matchesRegex: self class validSlug) ifFalse: [ ATDDInvalidSlugError signal ]
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"token" : "ClassTest 6/25/2021 16:28",
"token:" : "ClassTest 6/25/2021 16:28",
"update" : "ClassTest 6/25/2021 16:27",
"validate:" : "ClassTest 6/25/2021 16:58" } }
"validate:" : "ng 7/11/2021 15:19" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
message
defaultMessage

^ 'Access denied'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"class" : {
"message" : "ng 6/18/2021 13:55",
"rateLimitMessage" : "BF 6/18/2021 14:51" },
"defaultMessage" : "ng 7/9/2021 18:25" },
"instance" : {
"defaultAction" : "ng 6/18/2021 13:53" } }
} }
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"name" : "ATDDAccessDeniedError",
"pools" : [
],
"super" : "Error",
"super" : "ATDDError",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
defaultMessage

^ 'Not a valid token.'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"class" : {
},
"defaultMessage" : "ng 7/9/2021 18:27" },
"instance" : {
"defaultAction" : "ng 6/18/2021 14:03" } }
} }
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"name" : "ATDDConnectionError",
"pools" : [
],
"super" : "Error",
"super" : "ATDDError",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An ATDDError is an abstraction of any Error in AutoTDD.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
defaultMessage

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
priv handling
defaultAction

^ Transcript show: self class defaultMessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"defaultMessage" : "ng 7/9/2021 18:25" },
"instance" : {
"defaultAction" : "ng 7/9/2021 18:31" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "AutoTDD-Exceptions",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "ng 7/9/2021 18:32",
"instvars" : [
],
"name" : "ATDDError",
"pools" : [
],
"super" : "Error",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
noValidSlugMessage
defaultMessage

^ 'No valid slug provided'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"defaultMessage" : "ng 7/9/2021 18:28" },
"instance" : {
} }
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"commentStamp" : "be 7/25/2019 10:29",
"instvars" : [
],
"name" : "ATDDNoValidSlugError",
"name" : "ATDDInvalidSlugError",
"pools" : [
],
"super" : "Error",
"super" : "ATDDError",
"type" : "normal" }

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
defaultMessage

^ 'Error 404! Please provide a valid {owner}/{repo}'

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"class" : {
"message" : "ng 6/18/2021 13:55" },
"defaultMessage" : "ng 7/9/2021 18:37" },
"instance" : {
"defaultAction" : "ng 6/18/2021 13:59" } }
} }
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"name" : "ATDDNotFoundError",
"pools" : [
],
"super" : "Error",
"super" : "ATDDError",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An ATDDRateLimitError is an ATDDAccessDeniedError that was thrown because the API's rate limit was exceeded.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
rateLimitMessage
defaultMessage

^ 'You have been rate-limited. This GitHub Action will now be paused. Consider providing a token to prevent this.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"defaultMessage" : "ng 7/9/2021 18:35" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "AutoTDD-Exceptions",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "ng 7/9/2021 18:34",
"instvars" : [
],
"name" : "ATDDRateLimitError",
"pools" : [
],
"super" : "ATDDAccessDeniedError",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ refreshGitHubAction: aGitHubAction
[ aGitHubAction refresh ]
on: ATDDAccessDeniedError
do: [
UIManager default inform: ATDDAccessDeniedError rateLimitMessage.
UIManager default inform: ATDDRateLimitError defaultMessage.
self pauseTestingEntity: aGitHubAction
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ resumeGitHubAction: aGitHubAction
[ aGitHubAction resume ]
on: ATDDAccessDeniedError
do: [
UIManager default inform: ATDDAccessDeniedError rateLimitMessage.
UIManager default inform: ATDDRateLimitError defaultMessage.
self pauseTestingEntity: aGitHubAction
]
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"pauseTestingEntity:" : "sw 5/28/2021 15:17",
"pauseTravisStatuses" : "sw 5/26/2021 00:03",
"pauseWatchers" : "sw 5/26/2021 00:04",
"refreshGitHubAction:" : "BF 6/18/2021 14:51",
"refreshGitHubAction:" : "ng 7/9/2021 18:36",
"refreshTravisStatus:" : "swi 7/10/2019 14:03",
"removeGitHubActions:" : "sw 5/25/2021 22:58",
"removeSelectedGitHubActions" : "sw 5/24/2021 14:00",
Expand All @@ -128,7 +128,7 @@
"resultsTravisStatuses" : "sw 5/26/2021 00:07",
"resultsWatchers" : "sw 5/26/2021 00:07",
"resumeAll" : "sw 5/21/2021 21:05",
"resumeGitHubAction:" : "BF 6/18/2021 14:51",
"resumeGitHubAction:" : "ng 7/9/2021 18:36",
"resumeSelectedGitHubActions" : "sw 5/21/2021 22:17",
"resumeSelectedTravisStatuses" : "swi 7/25/2019 15:30",
"resumeSelectedWatchers" : "swi 7/25/2019 15:31",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
testing
makesValidRequest

| client |

client := ATDDGitHubActionsClient new.
client token: self token.
(client requestOn: 'repos/' , self repositoryUrl)
ifNil: [ ^ false ].

^ true
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ save
repositoryUrl changed: #acceptChanges.
token changed: #acceptChanges.
refreshInterval changed: #acceptChanges.

self hasVaildRefreshInterval
ifFalse: [
UIManager default inform: 'Please enter a valid interval!'.
Expand All @@ -12,11 +13,18 @@ save
ifFalse: [
UIManager default inform: 'Please enter a valid slug!'.
^ nil ].
self hasValidUrl
ifFalse: [
UIManager default inform: 'Error 404! Please provide a valid {owner}/{repo}'.

[ self makesValidRequest ]
on: ATDDConnectionError
do: [ UIManager default inform: ATDDConnectionError defaultMessage.
^ nil ]
on: ATDDAccessDeniedError
do: [ UIManager default inform: ATDDRateLimitError defaultMessage.
^ nil ]
on: ATDDNotFoundError
do: [ UIManager default inform: ATDDNotFoundError defaultMessage.
^ nil ].

super save.
self closeWindow.

^ self applyChanges
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"instance" : {
"applyChanges" : "BF 6/18/2021 14:54",
"gitHubAction" : "sw 5/25/2021 19:21",
"hasValidUrl" : "BF 6/18/2021 14:52",
"save" : "ng 6/18/2021 14:53" } }
"makesValidRequest" : "ng 7/9/2021 18:14",
"save" : "ng 7/9/2021 18:37" } }
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ updateJobLogForId: aNumber

[ response := self data client getLogsForRepository: self data repository logId: aNumber ]
on: ATDDAccessDeniedError
do: [ :error | response := error class message , '. Logs are only available when providing a token.' ]
do: [ :error | response := error class defaultMessage , '. Logs are only available when providing a token.' ]
on: ATDDNotFoundError
do: [ :error | response := error class message , '. No logs available for this workflow.' ].
do: [ :error | response := error class defaultMessage , '. No logs available for this workflow.' ].

(self shouldSimplifyLog)
ifTrue: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
"simplifyLogCheckBoxFrame" : "BF 6/20/2021 16:35",
"simplifyLogCheckBoxLabel" : "BF 6/20/2021 16:35",
"simplifyLogCheckBoxState" : "BF 6/20/2021 16:36",
"updateJobLogForId:" : "BF 6/20/2021 16:36",
"updateJobLogForId:" : "ng 7/9/2021 18:26",
"updateJobs" : "BF 6/25/2021 17:13" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ tests
testValidateSlug

self
shouldnt: [ repository repository: 'a/b' ] raise: ATDDNoValidSlugError;
shouldnt: [ repository repository: 'a0/-b' ] raise: ATDDNoValidSlugError;
should: [ repository repository: 'a/' ] raise: ATDDNoValidSlugError;
should: [ repository repository: '/b' ] raise: ATDDNoValidSlugError;
should: [ repository repository: '/' ] raise: ATDDNoValidSlugError;
should: [ repository repository: 'a /b' ] raise: ATDDNoValidSlugError;
should: [ repository repository: 'a/ b' ] raise: ATDDNoValidSlugError;
should: [ repository repository: ' a/b' ] raise: ATDDNoValidSlugError;
should: [ repository repository: 'a/b ' ] raise: ATDDNoValidSlugError;
should: [ repository repository: 'a/b/c' ] raise: ATDDNoValidSlugError;
should: [ repository repository: 'ab' ] raise: ATDDNoValidSlugError
shouldnt: [ repository repository: 'a/b' ] raise: ATDDInvalidSlugError;
shouldnt: [ repository repository: 'a0/-b' ] raise: ATDDInvalidSlugError;
should: [ repository repository: 'a/' ] raise: ATDDInvalidSlugError;
should: [ repository repository: '/b' ] raise: ATDDInvalidSlugError;
should: [ repository repository: '/' ] raise: ATDDInvalidSlugError;
should: [ repository repository: 'a /b' ] raise: ATDDInvalidSlugError;
should: [ repository repository: 'a/ b' ] raise: ATDDInvalidSlugError;
should: [ repository repository: ' a/b' ] raise: ATDDInvalidSlugError;
should: [ repository repository: 'a/b ' ] raise: ATDDInvalidSlugError;
should: [ repository repository: 'a/b/c' ] raise: ATDDInvalidSlugError;
should: [ repository repository: 'ab' ] raise: ATDDInvalidSlugError
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"tearDown" : "ClassTest 7/3/2021 20:59",
"testInitialization" : "ClassTest 7/3/2021 20:59",
"testRequireRepository" : "ng 7/2/2021 18:47",
"testValidateSlug" : "ClassTest 6/25/2021 16:59" } }
"testValidateSlug" : "ng 7/11/2021 15:19" } }
Loading

0 comments on commit 435269e

Please sign in to comment.