Implement simple authkey and console tests
This commit is contained in:
@@ -16,13 +16,19 @@
|
||||
|
||||
package client
|
||||
|
||||
import . "github.com/minio-io/check"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
type ClientSuite struct{}
|
||||
. "github.com/minio-io/check"
|
||||
)
|
||||
|
||||
var _ = Suite(&ClientSuite{})
|
||||
func Test(t *testing.T) { TestingT(t) }
|
||||
|
||||
func (s *ClientSuite) TestAuthAccessKeyLength(c *C) {
|
||||
type MySuite struct{}
|
||||
|
||||
var _ = Suite(&MySuite{})
|
||||
|
||||
func (s *MySuite) TestAuthAccessKeyLength(c *C) {
|
||||
// short
|
||||
result := IsValidSecretKey("123456789012345678901234567890123456789")
|
||||
c.Assert(result, Equals, false)
|
||||
@@ -36,7 +42,7 @@ func (s *ClientSuite) TestAuthAccessKeyLength(c *C) {
|
||||
c.Assert(result, Equals, true)
|
||||
}
|
||||
|
||||
func (s *ClientSuite) TestValidAccessKeyLength(c *C) {
|
||||
func (s *MySuite) TestValidAccessKeyLength(c *C) {
|
||||
// short
|
||||
result := IsValidAccessKey("1234567890123456789")
|
||||
c.Assert(result, Equals, false)
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Mini Copy, (C) 2015 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
. "github.com/minio-io/check"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) { TestingT(t) }
|
||||
|
||||
type MySuite struct{}
|
||||
|
||||
var _ = Suite(&MySuite{})
|
||||
|
||||
func (s *MySuite) TestSetTheme(c *C) {
|
||||
err := SetTheme("nocolor")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(GetTheme(), Equals, "nocolor")
|
||||
err = SetTheme("unknown")
|
||||
c.Assert(err, Not(IsNil))
|
||||
c.Assert(GetTheme(), Equals, "nocolor")
|
||||
}
|
||||
|
||||
func (s *MySuite) TestDefaultTheme(c *C) {
|
||||
if runtime.GOOS == "windows" {
|
||||
c.Assert(GetDefaultTheme(), Equals, "nocolor")
|
||||
} else {
|
||||
c.Assert(GetDefaultTheme(), Equals, "minimal")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user