Further fixes -

- All test files have been renamed to their respective <package>_test name,
    this is done in accordance with
      - https://github.com/golang/go/wiki/CodeReviewComments#import-dot
        imports are largely used in testing, but to avoid namespace collision
        and circular dependencies

  - Never use _* in package names other than "_test" change fragment_v1 to expose
    fragment just like 'gopkg.in/check.v1'
This commit is contained in:
Harshavardhana
2015-03-06 01:50:51 -08:00
parent 02ccf123c9
commit e5af8a3f5d
24 changed files with 245 additions and 285 deletions

View File

@@ -14,11 +14,12 @@
* limitations under the License.
*/
package keys
package keys_test
import (
"testing"
"github.com/minio-io/minio/pkg/utils/crypto/keys"
. "gopkg.in/check.v1"
)
@@ -28,11 +29,11 @@ type MySuite struct{}
var _ = Suite(&MySuite{})
func (s *MySuite) Testing(c *C) {
value, err := GenerateRandomBase64(MinioSecretID)
func (s *MySuite) TestingKeys(c *C) {
value, err := keys.GenerateRandomBase64(keys.MinioSecretID)
c.Assert(err, IsNil)
alphanum, err := GenerateRandomAlphaNumeric(MinioAccessID)
alphanum, err := keys.GenerateRandomAlphaNumeric(keys.MinioAccessID)
c.Assert(err, IsNil)
c.Log(string(value))

View File

@@ -1,10 +1,11 @@
package md5
package md5_test
import (
"bytes"
"encoding/hex"
"testing"
"github.com/minio-io/minio/pkg/utils/crypto/md5"
. "gopkg.in/check.v1"
)
@@ -17,7 +18,7 @@ var _ = Suite(&MySuite{})
func (s *MySuite) TestMd5sum(c *C) {
testString := []byte("Test string")
expectedHash, _ := hex.DecodeString("0fd3dbec9730101bff92acc820befc34")
hash, err := Sum(bytes.NewBuffer(testString))
hash, err := md5.Sum(bytes.NewBuffer(testString))
c.Assert(err, IsNil)
c.Assert(bytes.Equal(expectedHash, hash), Equals, true)
}

View File

@@ -14,12 +14,13 @@
* limitations under the License.
*/
package x509
package x509_test
import (
"testing"
"time"
"github.com/minio-io/minio/pkg/utils/crypto/x509"
. "gopkg.in/check.v1"
)
@@ -30,8 +31,8 @@ type MySuite struct{}
var _ = Suite(&MySuite{})
func (s *MySuite) Testing(c *C) {
certObj := Certificates{}
params := Params{
certObj := x509.Certificates{}
params := x509.Params{
Hostname: "example.com",
IsCA: false,
EcdsaCurve: "P224",