summaryrefslogtreecommitdiffstats
path: root/resources/resource_transformers/integrity
diff options
context:
space:
mode:
Diffstat (limited to 'resources/resource_transformers/integrity')
-rw-r--r--resources/resource_transformers/integrity/integrity.go3
-rw-r--r--resources/resource_transformers/integrity/integrity_test.go10
2 files changed, 8 insertions, 5 deletions
diff --git a/resources/resource_transformers/integrity/integrity.go b/resources/resource_transformers/integrity/integrity.go
index 63f4f4c76..aef744443 100644
--- a/resources/resource_transformers/integrity/integrity.go
+++ b/resources/resource_transformers/integrity/integrity.go
@@ -23,6 +23,7 @@ import (
"hash"
"io"
+ "github.com/gohugoio/hugo/common/constants"
"github.com/gohugoio/hugo/resources/internal"
"github.com/gohugoio/hugo/resources"
@@ -47,7 +48,7 @@ type fingerprintTransformation struct {
}
func (t *fingerprintTransformation) Key() internal.ResourceTransformationKey {
- return internal.NewResourceTransformationKey("fingerprint", t.algo)
+ return internal.NewResourceTransformationKey(constants.ResourceTransformationFingerprint, t.algo)
}
// Transform creates a MD5 hash of the Resource content and inserts that hash before
diff --git a/resources/resource_transformers/integrity/integrity_test.go b/resources/resource_transformers/integrity/integrity_test.go
index 27e193618..e0af68ae9 100644
--- a/resources/resource_transformers/integrity/integrity_test.go
+++ b/resources/resource_transformers/integrity/integrity_test.go
@@ -17,6 +17,7 @@ import (
"context"
"testing"
+ "github.com/gohugoio/hugo/config/testconfig"
"github.com/gohugoio/hugo/resources/resource"
qt "github.com/frankban/quicktest"
@@ -51,11 +52,12 @@ func TestHashFromAlgo(t *testing.T) {
func TestTransform(t *testing.T) {
c := qt.New(t)
- spec, err := htesting.NewTestResourceSpec()
- c.Assert(err, qt.IsNil)
- client := New(spec)
+ d := testconfig.GetTestDeps(nil, nil)
+ t.Cleanup(func() { c.Assert(d.Close(), qt.IsNil) })
+
+ client := New(d.ResourceSpec)
- r, err := htesting.NewResourceTransformerForSpec(spec, "hugo.txt", "Hugo Rocks!")
+ r, err := htesting.NewResourceTransformerForSpec(d.ResourceSpec, "hugo.txt", "Hugo Rocks!")
c.Assert(err, qt.IsNil)
transformed, err := client.Fingerprint(r, "")