v.1.0.20 webapi CORS
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user