-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit test for the API
trading_platform_password_reset
.
- Loading branch information
1 parent
e0fc9e6
commit 41892a3
Showing
3 changed files
with
42 additions
and
1 deletion.
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
13 changes: 13 additions & 0 deletions
13
...tion/api_manager/mock_data/trading_platform/trading_platform_password_reset_response.dart
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,13 @@ | ||
/// Mock data for trading platform password reset response. | ||
const String tradingPlatformPasswordResetResponse = ''' | ||
{ | ||
"echo_req": { | ||
"new_password": "<not shown>", | ||
"platform": "dxtrade", | ||
"trading_platform_password_reset": 1, | ||
"verification_code": "VYt3xeeu" | ||
}, | ||
"msg_type": "trading_platform_password_reset", | ||
"trading_platform_password_reset": 1 | ||
} | ||
'''; |
26 changes: 26 additions & 0 deletions
26
test/api/trading_platform/trading_platform_password_reset_test.dart
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,26 @@ | ||
import 'package:deriv_dependency_injector/dependency_injector.dart'; | ||
import 'package:flutter_deriv_api/api/api_initializer.dart'; | ||
import 'package:flutter_deriv_api/api/response/trading_platform_password_reset_response_extended.dart'; | ||
import 'package:flutter_deriv_api/api/response/trading_platform_password_reset_response_result.dart'; | ||
import 'package:flutter_deriv_api/basic_api/generated/trading_platform_password_reset_send.dart'; | ||
import 'package:flutter_deriv_api/services/connection/api_manager/mock_api.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
setUp(() => APIInitializer().initialize(api: MockAPI())); | ||
|
||
tearDown(() => Injector().dispose()); | ||
|
||
test('Reset trading platform password', () async { | ||
final TradingPlatformPasswordResetResponse passwordResetResponse = | ||
await TradingPlatformPasswordResetResponseExtended.resetPassword( | ||
request: const TradingPlatformPasswordResetRequest( | ||
newPassword: 'Tst12345#', | ||
platform: 'dxtrade', | ||
verificationCode: 'VYt3xeeu', | ||
), | ||
); | ||
|
||
expect(passwordResetResponse.tradingPlatformPasswordReset, true); | ||
}); | ||
} |