45 lines
1.3 KiB
Dart
45 lines
1.3 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:workouttest_util/model/cache.dart';
|
|
import 'package:workouttest_util/service/webapi.dart';
|
|
import 'package:workouttest_util/util/logging.dart';
|
|
|
|
class LoggingTest with Logging {}
|
|
|
|
main() {
|
|
late LoggingTest mockLogging;
|
|
setUp(() async {
|
|
mockLogging = LoggingTest();
|
|
await dotenv.load(fileName: "assets/.env");
|
|
Cache().setDietTestBaseUrl();
|
|
});
|
|
|
|
group('api', () {
|
|
test('connect webapi auth successfully', () async {
|
|
var api = APIWebClient();
|
|
var responseJson = await api.authenticateUser("bosi", "andio2009");
|
|
print(responseJson);
|
|
Cache().authToken = responseJson['token'];
|
|
final body = await api.get("customers/72", "");
|
|
print(body);
|
|
});
|
|
|
|
test('test customer conversation in utf8', () async {
|
|
var api = APIWebClient();
|
|
var responseJson = await api.authenticateUser("bosi", "andio2009");
|
|
print(responseJson);
|
|
Cache().authToken = responseJson['token'];
|
|
final body = await api.get("customer_conversation/72", "");
|
|
|
|
List<int> bytes3 = base64.decode(body);
|
|
String decodedString = utf8.decode(bytes3);
|
|
print(decodedString);
|
|
|
|
final body2 = await api.get("meal/21", "");
|
|
print(body2);
|
|
});
|
|
});
|
|
}
|