(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func 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 | } |
nothing calls this directly
no test coverage detected