MCPcopy Create free account
hub / github.com/NextDotID/proof_server / Test_ProofUpload

Function Test_ProofUpload

controller/proof_upload_test.go:12–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func Test_ProofUpload(t *testing.T) {
13 t.Run("success", func(t *testing.T) {
14 before_each(t)
15
16 req := ProofUploadRequest{
17 Action: types.Actions.Create,
18 Platform: types.Platforms.Twitter,
19 Identity: "yeiwb",
20 ProofLocation: "1504363098328924163",
21 PublicKey: "0x03666b700aeb6a6429f13cbb263e1bc566cd975a118b61bc796204109c1b351d19",
22 CreatedAt: "1647503071",
23 Uuid: "c6fa1483-1bad-4f07-b661-678b191ab4b3",
24 }
25 resp := ErrorResponse{}
26 APITestCall(Engine, "POST", "/v1/proof", &req, &resp)
27 assert.Empty(t, resp.Message)
28
29 pc := model.ProofChain{
30 Action: req.Action,
31 Platform: req.Platform,
32 Identity: req.Identity,
33 Location: req.ProofLocation,
34 }
35 model.DB.Where(&pc).First(&pc)
36 assert.Greater(t, pc.ID, int64(0))
37 assert.Equal(t, req.PublicKey, pc.Persona)
38 orig_created_at, _ := util.TimestampStringToTime(req.CreatedAt)
39 assert.Equal(t, pc.CreatedAt, orig_created_at)
40
41 proof := model.Proof{
42 Platform: req.Platform,
43 Identity: req.Identity,
44 Location: req.ProofLocation,
45 }
46 model.DB.Where(&proof).First(&proof)
47 assert.Greater(t, proof.ID, int64(0))
48 assert.Equal(t, req.PublicKey, proof.Persona)
49 })
50}

Callers

nothing calls this directly

Calls 3

TimestampStringToTimeFunction · 0.92
before_eachFunction · 0.70
APITestCallFunction · 0.70

Tested by

no test coverage detected