MCPcopy Index your code
hub / github.com/PasarGuard/node / TestGRPC_SyncUsers

Function TestGRPC_SyncUsers

controller/rpc/rpc_test.go:202–267  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestGRPC_SyncUsers(t *testing.T) {
203 ctx, cancel := context.WithTimeout(sharedTestCtx.ctxWithSession, 10*time.Second)
204 defer cancel()
205
206 syncUser, _ := sharedTestCtx.client.SyncUser(ctx)
207
208 user1 := &common.User{
209 Email: "test_user1@example.com",
210 Inbounds: []string{
211 "VMESS TCP NOTLS",
212 "VLESS TCP REALITY",
213 "TROJAN TCP NOTLS",
214 "Shadowsocks TCP",
215 "Shadowsocks UDP",
216 },
217 Proxies: &common.Proxy{
218 Vmess: &common.Vmess{
219 Id: uuid.New().String(),
220 },
221 Vless: &common.Vless{
222 Id: uuid.New().String(),
223 },
224 Trojan: &common.Trojan{
225 Password: "try a random string",
226 },
227 Shadowsocks: &common.Shadowsocks{
228 Password: "try a random string",
229 Method: "aes-256-gcm",
230 },
231 },
232 }
233
234 if err := syncUser.Send(user1); err != nil {
235 t.Fatalf("Failed to sync user1: %v", err)
236 }
237
238 user2 := &common.User{
239 Email: "test_user2@example.com",
240 Inbounds: []string{
241 "VMESS TCP NOTLS",
242 "VLESS TCP REALITY",
243 "TROJAN TCP NOTLS",
244 "Shadowsocks TCP",
245 "Shadowsocks UDP",
246 },
247 Proxies: &common.Proxy{
248 Vmess: &common.Vmess{
249 Id: uuid.New().String(),
250 },
251 Vless: &common.Vless{
252 Id: uuid.New().String(),
253 },
254 Trojan: &common.Trojan{
255 Password: "try a random string",
256 },
257 Shadowsocks: &common.Shadowsocks{
258 Password: "try a random string",
259 Method: "aes-256-gcm",

Callers

nothing calls this directly

Calls 2

SyncUserMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected