summaryrefslogtreecommitdiff
path: root/pkg/backend/api.go
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-18 20:42:29 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-26 12:17:30 +0200
commitcdb42f0d6b47a60ceb647e3ac6a6ce66352dbae4 (patch)
tree40f76de30181eb1036d44516e5dd05488c8c31dc /pkg/backend/api.go
parent4de5748e25678dce9c5a344afc5fd40508c0860f (diff)
[test] minimal qml tests
just a minimal boilerplate. the idea is to import the qml files and assert that the states/widgets change accordingly if we mock the backend status. - Closes: #300
Diffstat (limited to 'pkg/backend/api.go')
-rw-r--r--pkg/backend/api.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index a19fd40..fea38db 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -45,10 +45,18 @@ func SubscribeToEvent(event string, f unsafe.Pointer) {
subscribe(event, f)
}
-func InitializeBitmaskContext() {
+type InitOpts struct {
+ Provider string
+ AppName string
+ SkipLaunch bool
+}
+
+func InitializeBitmaskContext(opts *InitOpts) {
p := bitmask.GetConfiguredProvider()
+ opts.Provider = p.Provider
+ opts.AppName = p.AppName
- initOnce.Do(func() { initializeContext(p.Provider, p.AppName) })
+ initOnce.Do(func() { initializeContext(opts) })
runDonationReminder()
go ctx.updateStatus()
}
@@ -62,7 +70,7 @@ func InstallHelpers() {
pickle.InstallHelpers()
}
-func MockUIInteraction() {
- log.Println("mocking ui interaction on port 8080. \nTry 'curl localhost:8080/{on|off|failed}' to toggle status.")
- go mockUI()
+func EnableMockBackend() {
+ log.Println("[+] Mocking ui interaction on port 8080. \nTry 'curl localhost:8080/{on|off|failed}' to toggle status.")
+ go enableMockBackend()
}