grim/convey

Add new task aws/ecr-login for logging into AWS ECR. Fixed #161
// Convey
// Copyright 2016-2018 Gary Kramlich <grim@reaperworld.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package docker
import (
"github.com/aphistic/sweet"
"github.com/kballard/go-shellquote"
. "github.com/onsi/gomega"
)
type parserSuite struct{}
func (s *parserSuite) TestECRGetLogin(t sweet.T) {
// load the file with our test data
data := t.Sweet().LoadFile("data/aws-ecr-get-login.txt")
// shell split the data from the file
argv, err := shellquote.Split(string(data))
Expect(err).To(BeNil())
task, err := ParseCommand(argv)
Expect(err).To(BeNil())
Expect(task).To(Not(BeNil()))
// make sure we can type assert into a Login command
Expect(task).To(BeAssignableToTypeOf(&Login{}))
login := task.(*Login)
// now check the login command
Expect(login.Username).To(Equal("AWS"))
Expect(login.Password).To(Equal("password"))
Expect(login.Server).To(Equal("https://1234567890.dkr.ecr.us-east-2.amazonaws.com"))
}