-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor proposal: use unnamed callback function in with*HttpPubApiCl…
…ient methods. (#8490)
- Loading branch information
Showing
14 changed files
with
89 additions
and
91 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
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ void main() { | |
group('Moderate package', () { | ||
Future<ModerationCase> _report(String package) async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
subject: 'package:$package', | ||
|
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ void main() { | |
group('Moderate package version', () { | ||
Future<ModerationCase> _report(String package, String version) async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
subject: 'package-version:$package/$version', | ||
|
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('Moderate Publisher', () { | ||
Future<ModerationCase> _report(String publisherId) async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
subject: 'publisher:$publisherId', | ||
|
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 |
---|---|---|
|
@@ -29,7 +29,7 @@ void main() { | |
group('Moderate User', () { | ||
Future<ModerationCase> _report(String package) async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await client.postReport(account_api.ReportForm( | ||
email: '[email protected]', | ||
subject: 'package:$package', | ||
|
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ void main() { | |
required bool? apply, | ||
}) async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
caseId: appealCaseId, | ||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ void main() { | |
String? caseId, | ||
}) async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await client.postReport(account_api.ReportForm( | ||
email: email ?? '[email protected]', | ||
subject: 'package:$package', | ||
|
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 |
---|---|---|
|
@@ -79,7 +79,7 @@ void main() { | |
group('Report API test', () { | ||
testWithProfile('unauthenticated email missing', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
message: 'Problem.', | ||
|
@@ -100,7 +100,7 @@ void main() { | |
await withHttpPubApiClient( | ||
sessionId: sessionId, | ||
csrfToken: csrfToken, | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -118,7 +118,7 @@ void main() { | |
|
||
testWithProfile('subject missing', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -135,7 +135,7 @@ void main() { | |
|
||
testWithProfile('subject is invalid', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -153,7 +153,7 @@ void main() { | |
|
||
testWithProfile('package missing', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -171,7 +171,7 @@ void main() { | |
|
||
testWithProfile('version missing', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -189,7 +189,7 @@ void main() { | |
|
||
testWithProfile('publisher missing', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -212,7 +212,7 @@ void main() { | |
await withHttpPubApiClient( | ||
sessionId: sessionId, | ||
csrfToken: csrfToken, | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
subject: 'package:oxygen', | ||
|
@@ -230,7 +230,7 @@ void main() { | |
|
||
testWithProfile('unauthenticated report success', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
subject: 'package:oxygen', | ||
|
@@ -259,7 +259,7 @@ void main() { | |
await withHttpPubApiClient( | ||
sessionId: sessionId, | ||
csrfToken: csrfToken, | ||
fn: (client) async { | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
message: 'Huston, we have a problem.', | ||
subject: 'package:oxygen', | ||
|
@@ -308,7 +308,7 @@ void main() { | |
|
||
testWithProfile('failure: case does not exists', fn: () async { | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -327,7 +327,7 @@ void main() { | |
testWithProfile('failure: case is not closed', fn: () async { | ||
await _prepareApplied(status: ModerationStatus.pending); | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -346,7 +346,7 @@ void main() { | |
testWithProfile('failure: subject is not on the case', fn: () async { | ||
await _prepareApplied(); | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -371,7 +371,7 @@ void main() { | |
|
||
// first report: success | ||
await withHttpPubApiClient( | ||
fn: (client) async { | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
email: '[email protected]', | ||
subject: 'package-version:oxygen/1.2.0', | ||
|
@@ -400,7 +400,7 @@ void main() { | |
); | ||
|
||
// second report: rejected | ||
await withHttpPubApiClient(fn: (client) async { | ||
await withHttpPubApiClient((client) async { | ||
await expectApiException( | ||
client.postReport(ReportForm( | ||
email: '[email protected]', | ||
|
@@ -423,7 +423,7 @@ void main() { | |
|
||
await withFakeAuthHttpPubApiClient( | ||
email: '[email protected]', | ||
fn: (client) async { | ||
(client) async { | ||
final msg = await client.postReport(ReportForm( | ||
subject: 'package-version:oxygen/1.2.0', | ||
caseId: 'case/1', | ||
|
Oops, something went wrong.