<commit_before>package fly_test

import (
	"os/exec"

	"github.com/concourse/fly/rc"
	"github.com/concourse/testflight/helpers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/ginkgo/extensions/table"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

const bogusTarget = "bogus-target"

var _ = Describe("the quality of being unauthenticated", func() {
	BeforeEach(func() {
		noAuth, _, _, err := helpers.GetAuthMethods(atcURL)
		Expect(err).ToNot(HaveOccurred())
		if noAuth {
			Skip("No auth methods enabled; skipping unauthenticated tests")
		}

		err = rc.SaveTarget(bogusTarget, atcURL, false, "main", nil)
		Expect(err).ToNot(HaveOccurred())
	})

	DescribeTable("trying to run commands when unauthenticated",
		func(passedArgs ...string) {
			args := append([]string{"-t", bogusTarget}, passedArgs...)
			fly := exec.Command(flyBin, args...)
			session := helpers.StartFly(fly)

			<-session.Exited
			Expect(session.ExitCode()).To(Equal(1))

			Expect(session.Err).To(gbytes.Say("not authorized"))
		},

		Entry("get-pipeline", "get-pipeline", "-p", "john"),
		Entry("set-pipeline", "set-pipeline", "-p", "john", "-c", "../fixtures/simple-pipeline.yml"),
		Entry("pause-pipeline", "pause-pipeline", "-p", "john"),
		Entry("unpause-pipeline", "unpause-pipeline", "-p", "john"),
		Entry("checklist", "checklist", "-p", "john"),
		Entry("containers", "containers"),
		Entry("volumes", "volumes"),
		Entry("workers", "workers"),
		Entry("execute", "execute", "-c", "../fixtures/simple-task.yml"),
		Entry("watch", "watch"),
		Entry("hijack", "hijack"),
	)

	DescribeTable("trying to run commands that require confirmation when unauthenticated",
		func(passedArgs ...string) {
			args := append([]string{"-t", bogusTarget}, passedArgs...)<commit_msg>Updates testflight to match new fly code<commit_after>package fly_test

import (
	"os/exec"

	"github.com/concourse/fly/rc"
	"github.com/concourse/testflight/helpers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/ginkgo/extensions/table"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

const bogusTarget = "bogus-target"

var _ = Describe("the quality of being unauthenticated", func() {
	BeforeEach(func() {
		noAuth, _, _, err := helpers.GetAuthMethods(atcURL)
		Expect(err).ToNot(HaveOccurred())
		if noAuth {
			Skip("No auth methods enabled; skipping unauthenticated tests")
		}

		err = rc.SaveTarget(bogusTarget, atcURL, false, "main", nil, "")
		Expect(err).ToNot(HaveOccurred())
	})

	DescribeTable("trying to run commands when unauthenticated",
		func(passedArgs ...string) {
			args := append([]string{"-t", bogusTarget}, passedArgs...)
			fly := exec.Command(flyBin, args...)
			session := helpers.StartFly(fly)

			<-session.Exited
			Expect(session.ExitCode()).To(Equal(1))

			Expect(session.Err).To(gbytes.Say("not authorized"))
		},

		Entry("get-pipeline", "get-pipeline", "-p", "john"),
		Entry("set-pipeline", "set-pipeline", "-p", "john", "-c", "../fixtures/simple-pipeline.yml"),
		Entry("pause-pipeline", "pause-pipeline", "-p", "john"),
		Entry("unpause-pipeline", "unpause-pipeline", "-p", "john"),
		Entry("checklist", "checklist", "-p", "john"),
		Entry("containers", "containers"),
		Entry("volumes", "volumes"),
		Entry("workers", "workers"),
		Entry("execute", "execute", "-c", "../fixtures/simple-task.yml"),
		Entry("watch", "watch"),
		Entry("hijack", "hijack"),
	)

	DescribeTable("trying to run commands that require confirmation when unauthenticated",
		func(passedArgs ...string) {
			args := append([]string{"-t", bogusTarget}, passedArgs...)
{'fraction_non_alphanumeric': 0.19887798036465637, 'fraction_numerical': 0.0005610098176718093, 'mean_word_length': 4.714743589743589, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7380019', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1233, 'n_words': 231}