-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor of the withHttpPubApiClient method(s). (#8495)
- Loading branch information
Showing
14 changed files
with
82 additions
and
67 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
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
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ void main() { | |
group('Uploader invite', () { | ||
Future<String?> inviteUploader( | ||
{String adminEmail = '[email protected]'}) async { | ||
await withFakeAuthHttpPubApiClient( | ||
await withFakeAuthRetryPubApiClient( | ||
email: adminEmail, | ||
pubHostedUrl: activeConfiguration.primarySiteUri.toString(), | ||
(client) async { | ||
|
@@ -309,7 +309,7 @@ void main() { | |
|
||
group('Sanity check', () { | ||
testWithProfile('consent parameter length', fn: () async { | ||
await withFakeAuthHttpPubApiClient(email: adminAtPubDevEmail, (c) async { | ||
await withFakeAuthRetryPubApiClient(email: adminAtPubDevEmail, (c) async { | ||
await expectApiException( | ||
c.consentInfo('abcd' * 500), | ||
status: 400, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ import '../shared/test_services.dart'; | |
void main() { | ||
group('Moderate package', () { | ||
Future<ModerationCase> _report(String package) async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -33,7 +33,7 @@ import '../shared/test_services.dart'; | |
void main() { | ||
group('Moderate package version', () { | ||
Future<ModerationCase> _report(String package, String version) async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ import '../shared/test_services.dart'; | |
void main() { | ||
group('Moderate Publisher', () { | ||
Future<ModerationCase> _report(String publisherId) async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ import '../shared/test_services.dart'; | |
void main() { | ||
group('Moderate User', () { | ||
Future<ModerationCase> _report(String package) async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await client.postReport(account_api.ReportForm( | ||
email: '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ void main() { | |
String? appealCaseId, | ||
required bool? apply, | ||
}) async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ void main() { | |
String? email, | ||
String? caseId, | ||
}) async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await client.postReport(account_api.ReportForm( | ||
email: email ?? '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -78,7 +78,7 @@ void main() { | |
|
||
group('Report API test', () { | ||
testWithProfile('unauthenticated email missing', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -97,7 +97,7 @@ void main() { | |
await withFakeAuthRequestContext('[email protected]', () async { | ||
final sessionId = requestContext.sessionData?.sessionId; | ||
final csrfToken = requestContext.csrfToken; | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
sessionId: sessionId, | ||
csrfToken: csrfToken, | ||
(client) async { | ||
|
@@ -117,7 +117,7 @@ void main() { | |
}); | ||
|
||
testWithProfile('subject missing', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -134,7 +134,7 @@ void main() { | |
}); | ||
|
||
testWithProfile('subject is invalid', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -152,7 +152,7 @@ void main() { | |
}); | ||
|
||
testWithProfile('package missing', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -170,7 +170,7 @@ void main() { | |
}); | ||
|
||
testWithProfile('version missing', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -188,7 +188,7 @@ void main() { | |
}); | ||
|
||
testWithProfile('publisher missing', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -209,7 +209,7 @@ void main() { | |
await withFakeAuthRequestContext('[email protected]', () async { | ||
final sessionId = requestContext.sessionData?.sessionId; | ||
final csrfToken = requestContext.csrfToken; | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
sessionId: sessionId, | ||
csrfToken: csrfToken, | ||
(client) async { | ||
|
@@ -229,7 +229,7 @@ void main() { | |
}); | ||
|
||
testWithProfile('unauthenticated report success', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -256,7 +256,7 @@ void main() { | |
await withFakeAuthRequestContext('[email protected]', () async { | ||
final sessionId = requestContext.sessionData?.sessionId; | ||
final csrfToken = requestContext.csrfToken; | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
sessionId: sessionId, | ||
csrfToken: csrfToken, | ||
(client) async { | ||
|
@@ -307,7 +307,7 @@ void main() { | |
} | ||
|
||
testWithProfile('failure: case does not exists', fn: () async { | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -326,7 +326,7 @@ void main() { | |
|
||
testWithProfile('failure: case is not closed', fn: () async { | ||
await _prepareApplied(status: ModerationStatus.pending); | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -345,7 +345,7 @@ void main() { | |
|
||
testWithProfile('failure: subject is not on the case', fn: () async { | ||
await _prepareApplied(); | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
|
@@ -370,7 +370,7 @@ void main() { | |
); | ||
|
||
// first report: success | ||
await withHttpPubApiClient( | ||
await withRetryPubApiClient( | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -400,7 +400,7 @@ void main() { | |
); | ||
|
||
// second report: rejected | ||
await withHttpPubApiClient((client) async { | ||
await withRetryPubApiClient((client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -421,7 +421,7 @@ void main() { | |
logSubject: 'package-version:oxygen/1.2.0', | ||
); | ||
|
||
await withFakeAuthHttpPubApiClient( | ||
await withFakeAuthRetryPubApiClient( | ||
email: '[email protected]', | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
|
Oops, something went wrong.