Spaces:
Paused
Paused
ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca Download api/pkg/di/container_test.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/di/container_test.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway/api/pkg/di/container_test.go
-
curl -L -o container_test.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/di/container_test.go
1.21 kB
| package di | |
| import ( | |
| "reflect" | |
| "testing" | |
| "github.com/NdoleStudio/httpsms/pkg/entities" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| "github.com/stretchr/testify/assert" | |
| "github.com/stretchr/testify/require" | |
| ) | |
| func TestNotificationHTTPClientUsesOTelRoundTripperWithoutRetries(t *testing.T) { | |
| t.Setenv("ENV", "local") | |
| client := NewLiteContainer().NotificationHTTPClient() | |
| assert.Zero(t, client.Timeout) | |
| assert.Equal(t, "*otelroundtripper.otelRoundTripper", reflect.TypeOf(client.Transport).String()) | |
| assert.Nil(t, client.CheckRedirect) | |
| } | |
| func TestPhoneNotificationClientsMapsConfiguredTransports(t *testing.T) { | |
| t.Setenv("ENV", "local") | |
| t.Setenv("FCM_ENDPOINT", "http://localhost") | |
| clients := NewLiteContainer().PhoneNotificationClients() | |
| require.Len(t, clients, 2) | |
| assert.IsType(t, &services.EmulatorFCMClient{}, clients[entities.NotificationTransportFCM]) | |
| httpSender, ok := clients[entities.NotificationTransportHTTP].(*services.HTTPNotificationSender) | |
| require.True(t, ok) | |
| client := reflect.ValueOf(httpSender).Elem().FieldByName("client").Elem() | |
| transport := client.FieldByName("Transport").Elem() | |
| assert.Equal(t, "*otelroundtripper.otelRoundTripper", transport.Type().String()) | |
| } | |