Skip to content

Commit cbb9e21

Browse files
committed
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 <[email protected]>
1 parent f5a75de commit cbb9e21

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

login1/dbus_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,27 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package login1
15+
package login1_test
1616

1717
import (
1818
"fmt"
1919
"os/user"
2020
"regexp"
2121
"testing"
22+
23+
"github.com/coreos/go-systemd/v22/login1"
2224
)
2325

2426
// TestNew ensures that New() works without errors.
2527
func TestNew(t *testing.T) {
26-
_, err := New()
27-
28+
_, err := login1.New()
2829
if err != nil {
2930
t.Fatal(err)
3031
}
3132
}
3233

3334
func TestListSessions(t *testing.T) {
34-
c, err := New()
35+
c, err := login1.New()
3536
if err != nil {
3637
t.Fatal(err)
3738
}
@@ -60,7 +61,7 @@ func TestListSessions(t *testing.T) {
6061
}
6162

6263
func TestListUsers(t *testing.T) {
63-
c, err := New()
64+
c, err := login1.New()
6465
if err != nil {
6566
t.Fatal(err)
6667
}

0 commit comments

Comments
 (0)