better moderation api tests
This commit is contained in:
@@ -24,8 +24,12 @@ void main() {
|
||||
|
||||
const path = '/moderation/mute';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(
|
||||
() => client.post(
|
||||
path,
|
||||
data: {'target_id': userId},
|
||||
),
|
||||
).thenAnswer((_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.muteUser(userId);
|
||||
|
||||
@@ -40,8 +44,12 @@ void main() {
|
||||
|
||||
const path = '/moderation/unmute';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(
|
||||
() => client.post(
|
||||
path,
|
||||
data: {'target_id': userId},
|
||||
),
|
||||
).thenAnswer((_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.unmuteUser(userId);
|
||||
|
||||
@@ -57,8 +65,15 @@ void main() {
|
||||
|
||||
const path = '/moderation/mute/channel';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(
|
||||
path,
|
||||
data: {
|
||||
'channel_cid': channelCid,
|
||||
'expiration': expiration.inMilliseconds,
|
||||
},
|
||||
))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.muteChannel(
|
||||
channelCid,
|
||||
@@ -76,8 +91,12 @@ void main() {
|
||||
|
||||
const path = '/moderation/unmute/channel';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(
|
||||
path,
|
||||
data: {'channel_cid': channelCid},
|
||||
))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.unmuteChannel(channelCid);
|
||||
|
||||
@@ -92,8 +111,14 @@ void main() {
|
||||
|
||||
const path = '/moderation/flag';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(
|
||||
path,
|
||||
data: {
|
||||
'target_message_id': messageId,
|
||||
},
|
||||
))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.flagMessage(messageId);
|
||||
|
||||
@@ -108,8 +133,14 @@ void main() {
|
||||
|
||||
const path = '/moderation/unflag';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(
|
||||
path,
|
||||
data: {
|
||||
'target_message_id': messageId,
|
||||
},
|
||||
))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.unflagMessage(messageId);
|
||||
|
||||
@@ -124,8 +155,11 @@ void main() {
|
||||
|
||||
const path = '/moderation/flag';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(path, data: {
|
||||
'target_user_id': userId,
|
||||
}))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.flagUser(userId);
|
||||
|
||||
@@ -140,8 +174,14 @@ void main() {
|
||||
|
||||
const path = '/moderation/unflag';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(
|
||||
path,
|
||||
data: {
|
||||
'target_user_id': userId,
|
||||
},
|
||||
))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.unflagUser(userId);
|
||||
|
||||
@@ -157,8 +197,12 @@ void main() {
|
||||
|
||||
const path = '/moderation/ban';
|
||||
|
||||
when(() => client.post(path, data: any(named: 'data'))).thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
when(() => client.post(path, data: {
|
||||
'target_user_id': targetUserId,
|
||||
...options,
|
||||
}))
|
||||
.thenAnswer(
|
||||
(_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.banUser(targetUserId, options: options);
|
||||
|
||||
@@ -175,7 +219,13 @@ void main() {
|
||||
const path = '/moderation/ban';
|
||||
|
||||
when(
|
||||
() => client.delete(path, queryParameters: any(named: 'queryParameters')),
|
||||
() => client.delete(
|
||||
path,
|
||||
queryParameters: {
|
||||
'target_user_id': targetUserId,
|
||||
...options,
|
||||
},
|
||||
),
|
||||
).thenAnswer((_) async => successResponse(path, data: <String, dynamic>{}));
|
||||
|
||||
final res = await moderationApi.unbanUser(targetUserId, options: options);
|
||||
|
||||
Reference in New Issue
Block a user