(t *testing.T)
| 52 | var testcases = test.TemplateSQL(srv_dao.NewKeyDAO) |
| 53 | |
| 54 | func TestHandler_GetObject(t *testing.T) { |
| 55 | |
| 56 | handler := &Handler{ |
| 57 | // UserTools: &EncryptionClientMock{}, |
| 58 | } |
| 59 | mock := nodes.NewHandlerMock() |
| 60 | mock.Nodes["test"] = &tree.Node{Path: "test"} |
| 61 | handler.SetNextHandler(mock) |
| 62 | |
| 63 | ctx := context.Background() |
| 64 | branchInfo := nodes.BranchInfo{} |
| 65 | branchInfo.DataSource = &object.DataSource{} |
| 66 | // branchInfo.Encrypted = true |
| 67 | ctx = nodes.WithBranchInfo(ctx, "in", branchInfo) |
| 68 | |
| 69 | Convey("Test Get Object without enc", t, func() { |
| 70 | |
| 71 | reqData := &models.GetRequestData{} |
| 72 | reader, e := handler.GetObject(ctx, &tree.Node{Path: "test"}, reqData) |
| 73 | So(reader, ShouldNotBeNil) |
| 74 | So(e, ShouldBeNil) |
| 75 | |
| 76 | }) |
| 77 | |
| 78 | Convey("Test Put Object without enc", t, func() { |
| 79 | |
| 80 | reqData := &models.PutRequestData{} |
| 81 | _, e := handler.PutObject(ctx, &tree.Node{Path: "test2"}, strings.NewReader(""), reqData) |
| 82 | // Wait for the stub to finish - TODO we should use actual service instead of stubs |
| 83 | <-time.After(time.Second * 1) |
| 84 | |
| 85 | So(e, ShouldBeNil) |
| 86 | So(mock.Nodes["in"], ShouldNotBeNil) |
| 87 | So(mock.Nodes["in"].Path, ShouldEqual, "test2") |
| 88 | |
| 89 | }) |
| 90 | |
| 91 | Convey("Test Copy Object without Enc", t, func() { |
| 92 | |
| 93 | ctx = nodes.WithBranchInfo(ctx, "from", branchInfo) |
| 94 | ctx = nodes.WithBranchInfo(ctx, "to", branchInfo) |
| 95 | reqData := &models.CopyRequestData{} |
| 96 | _, e := handler.CopyObject(ctx, &tree.Node{Path: "test2"}, &tree.Node{Path: "test2"}, reqData) |
| 97 | So(e, ShouldBeNil) |
| 98 | So(mock.Nodes["from"], ShouldNotBeNil) |
| 99 | So(mock.Nodes["to"], ShouldNotBeNil) |
| 100 | |
| 101 | }) |
| 102 | |
| 103 | } |
| 104 | |
| 105 | func TestHandler_GetPut_Encrypted(t *testing.T) { |
| 106 | sql.TestPrintQueries = false |
nothing calls this directly
no test coverage detected
searching dependent graphs…