Skip to content

Commit

Permalink
login1: Use blackbox testing
Browse files Browse the repository at this point in the history
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 <mgozdek@microsoft.com>
  • Loading branch information
invidian committed Jan 10, 2022
1 parent 4da2df9 commit c3a73b1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions login1/dbus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@
// 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()

_, err := login1.New()
if err != nil {
t.Fatal(err)
}
}

func TestListSessions(t *testing.T) {
c, err := New()
c, err := login1.New()
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -60,7 +61,7 @@ func TestListSessions(t *testing.T) {
}

func TestListUsers(t *testing.T) {
c, err := New()
c, err := login1.New()
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit c3a73b1

Please sign in to comment.