MCPcopy
hub / github.com/sideshow/apns2 / TestClientManagerGetMaxAgeExpirationWithNilFactory

Function TestClientManagerGetMaxAgeExpirationWithNilFactory

client_manager_test.go:104–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestClientManagerGetMaxAgeExpirationWithNilFactory(t *testing.T) {
105 manager := apns2.NewClientManager()
106 manager.Factory = func(certificate tls.Certificate) *apns2.Client {
107 return nil
108 }
109 manager.MaxAge = time.Nanosecond
110 manager.Add(apns2.NewClient(mockCert()))
111 c1 := manager.Get(mockCert())
112 time.Sleep(time.Microsecond)
113 c2 := manager.Get(mockCert())
114 assert.Nil(t, c1)
115 assert.Nil(t, c2)
116 assert.Equal(t, 1, manager.Len())
117}
118
119func TestClientManagerGetMaxSizeExceeded(t *testing.T) {
120 manager := apns2.NewClientManager()

Callers

nothing calls this directly

Calls 6

AddMethod · 0.95
GetMethod · 0.95
LenMethod · 0.95
NewClientManagerFunction · 0.92
NewClientFunction · 0.92
mockCertFunction · 0.85

Tested by

no test coverage detected