1515package regionsrv
1616
1717import (
18- "crypto/md5 "
18+ "crypto/sha256 "
1919 "errors"
2020 "fmt"
2121 "io"
@@ -41,7 +41,7 @@ func (t testCommand) Run() error {
4141
4242// Run this before each test to get the fixtures path right.
4343func beforeTest () {
44- hashFilePath = fixturesPath ("valid.md5 " )
44+ hashFilePath = fixturesPath ("valid.sha256 " )
4545 caFilePath = fixturesPath ("valid.pem" )
4646}
4747
@@ -85,14 +85,14 @@ func TestUpdateIsNeededCouldNotReadFile(t *testing.T) {
8585 }
8686}
8787
88- func TestSafeCAFileBadWrite (t * testing.T ) {
88+ func TestSaveCAFileBadWrite (t * testing.T ) {
8989 beforeTest ()
9090
91- hashFilePath = fixturesPath (fmt .Sprintf ("file%v.md5 " , rand .Int ()))
91+ hashFilePath = fixturesPath (fmt .Sprintf ("file%v.sha256 " , rand .Int ()))
9292 caFilePath = "/wubalubadubdub"
9393 cmd := testCommand {shouldFail : false }
9494
95- err := safeCAFile (cmd , "valid" )
95+ err := saveCAFile (cmd , "valid" )
9696 os .Remove (hashFilePath )
9797 os .Remove (caFilePath )
9898
@@ -101,14 +101,14 @@ func TestSafeCAFileBadWrite(t *testing.T) {
101101 }
102102}
103103
104- func TestSafeCAFileBadCommand (t * testing.T ) {
104+ func TestSaveCAFileBadCommand (t * testing.T ) {
105105 beforeTest ()
106106
107- hashFilePath = fixturesPath (fmt .Sprintf ("file%v.md5 " , rand .Int ()))
107+ hashFilePath = fixturesPath (fmt .Sprintf ("file%v.sha256 " , rand .Int ()))
108108 caFilePath = fixturesPath (fmt .Sprintf ("file%v.pem" , rand .Int ()))
109109 cmd := testCommand {shouldFail : true }
110110
111- err := safeCAFile (cmd , "valid" )
111+ err := saveCAFile (cmd , "valid" )
112112 os .Remove (hashFilePath )
113113 os .Remove (caFilePath )
114114
@@ -121,13 +121,13 @@ func TestSafeCAFileBadCommand(t *testing.T) {
121121 }
122122}
123123
124- func TestSafeCAFileSuccess (t * testing.T ) {
124+ func TestSaveCAFileSuccess (t * testing.T ) {
125125 beforeTest ()
126126
127- hashFilePath = fixturesPath ("tmp.md5 " )
127+ hashFilePath = fixturesPath ("tmp.sha256 " )
128128 cmd := testCommand {shouldFail : false }
129129
130- err := safeCAFile (cmd , "valid" )
130+ err := saveCAFile (cmd , "valid" )
131131 if err != nil {
132132 os .Remove (hashFilePath )
133133 t .Fatalf ("Expected error to be nil: %v\n " , err )
@@ -136,7 +136,7 @@ func TestSafeCAFileSuccess(t *testing.T) {
136136 b , _ := os .ReadFile (hashFilePath )
137137 os .Remove (hashFilePath )
138138
139- hash := md5 .New ()
139+ hash := sha256 .New ()
140140 io .WriteString (hash , "valid" )
141141 if string (b ) != string (hash .Sum (nil )) {
142142 t .Fatal ("Bad checksum" )
0 commit comments