<commit_before>package conn_test

import (
	"github.com/jordwest/imap-server/conn"
	. "github.com/onsi/ginkgo"
)

var _ = Describe("LOGOUT Command", func() {
	Context("When logged in", func() {
		BeforeEach(func() {
			tConn.SetState(conn.StateAuthenticated)
			tConn.User = mStore.User
		})

		It("should log the user out", func() {
			SendLine("abcd.123 LOGOUT")
			ExpectResponse("* BYE IMAP4rev1 server logging out")
			ExpectResponse("abcd.123 OK LOGOUT completed")
		})
	})

	Context("When not logged in", func() {
		BeforeEach(func() {
			tConn.SetState(conn.StateNotAuthenticated)
		})

		It("should give an error", func() {
			SendLine("abcd.123 LOGOUT")
			ExpectResponse("abcd.123 NO not logged in")
		})
	})
})<commit_msg>LOGOUT command should still work when not authenticated<commit_after>package conn_test

import (
	"github.com/jordwest/imap-server/conn"
	. "github.com/onsi/ginkgo"
)

var _ = Describe("LOGOUT Command", func() {
	Context("When logged in", func() {
		BeforeEach(func() {
			tConn.SetState(conn.StateAuthenticated)
			tConn.User = mStore.User
		})

		It("should log the user out", func() {
			SendLine("abcd.123 LOGOUT")
			ExpectResponse("* BYE IMAP4rev1 server logging out")
			ExpectResponse("abcd.123 OK LOGOUT completed")
		})
	})

	Context("When not logged in", func() {
		BeforeEach(func() {
			tConn.SetState(conn.StateNotAuthenticated)
		})

		It("should give an error", func() {
			SendLine("abcd.123 LOGOUT")
			ExpectResponse("* BYE IMAP4rev1 server logging out")
			ExpectResponse("abcd.123 OK LOGOUT completed")
		})
	})
})
{'fraction_non_alphanumeric': 0.14595283620140218, 'fraction_numerical': 0.019120458891013385, 'mean_word_length': 4.198675496688741, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3682639', 'n_tokens_mistral': 620, 'n_tokens_neox': 548, 'n_words': 120}