...

Source file src/github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cache/null_test.go

Documentation: github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cache

     1  // Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License"). You may
     4  // not use this file except in compliance with the License. A copy of the
     5  // License is located at
     6  //
     7  //	http://aws.amazon.com/apache2.0/
     8  //
     9  // or in the "license" file accompanying this file. This file is distributed
    10  // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
    11  // express or implied. See the License for the specific language governing
    12  // permissions and limitations under the License.
    13  
    14  package cache
    15  
    16  import (
    17  	"testing"
    18  
    19  	"github.com/stretchr/testify/assert"
    20  )
    21  
    22  func TestNullCache(t *testing.T) {
    23  	credentialCache := NewNullCredentialsCache()
    24  
    25  	entry := credentialCache.Get(testRegistryName)
    26  	assert.Nil(t, entry)
    27  
    28  	credentialCache.Set(testRegistryName, &testAuthEntry)
    29  
    30  	entry = credentialCache.Get(testRegistryName)
    31  	assert.Nil(t, entry)
    32  
    33  	credentialCache.Clear()
    34  
    35  	entries := credentialCache.List()
    36  	assert.Empty(t, entries)
    37  }
    38  

View as plain text