From c375e8dfd2ee3f1ab062469eed6e87105fb30217 Mon Sep 17 00:00:00 2001 From: Mateusz Gozdek Date: Mon, 10 Jan 2022 08:42:26 +0100 Subject: [PATCH] login1: Use blackbox testing This is a desired way of testing to avoid creating fragile test suites and be able to refactor code without touching tests. Signed-off-by: Mateusz Gozdek --- login1/dbus_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/login1/dbus_test.go b/login1/dbus_test.go index b570c921..e3ba930c 100644 --- a/login1/dbus_test.go +++ b/login1/dbus_test.go @@ -12,26 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -package login1 +package login1_test import ( "fmt" "os/user" "regexp" "testing" + + "github.com/coreos/go-systemd/v22/login1" ) // TestNew ensures that New() works without errors. func TestNew(t *testing.T) { - _, err := New() - - if err != nil { + if _, err := login1.New(); err != nil { t.Fatal(err) } } func TestListSessions(t *testing.T) { - c, err := New() + c, err := login1.New() if err != nil { t.Fatal(err) } @@ -60,7 +60,7 @@ func TestListSessions(t *testing.T) { } func TestListUsers(t *testing.T) { - c, err := New() + c, err := login1.New() if err != nil { t.Fatal(err) }