terraform/vendor/github.com/dylanmei/winrmtest
Paul Hinze 6fe2703665 Vendor all dependencies w/ Godep
* Remove `make updatedeps` from Travis build. We'll follow up with more
   specific plans around dependency updating in subsequent PRs.
 * Update all `make` targets to set `GO15VENDOREXPERIMENT=1` and to
   filter out `/vendor/` from `./...` where appropriate.
 * Temporarily remove `vet` from the `make test` target until we can
   figure out how to get it to not vet `vendor/`. (Initial
   experimentation failed to yield the proper incantation.)

Everything is pinned to current master, with the exception of:

 * Azure/azure-sdk-for-go which is pinned before the breaking change today
 * aws/aws-sdk-go which is pinned to the most recent tag

The documentation still needs to be updated, which we can do in a follow
up PR. The goal here is to unblock release.
2016-01-29 15:08:48 -06:00
..
LICENSE Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
README.md Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
remote.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
wsman.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00
wsman_test.go Vendor all dependencies w/ Godep 2016-01-29 15:08:48 -06:00

README.md

winrmtest

An in-progress testing package to compliment the masterzen/winrm Go-based winrm library.

My primary use-case for this is for dylanmei/packer-communicator-winrm, a Packer communicator plugin for interacting with machines using Windows Remote Management.

Example Use

A fictitious "Windows tools" package.


package wintools

import (
	"io"
	"testing"
	"github.com/dylanmei/winrmtest"
)

func Test_empty_temp_directory(t *testing.T) {
	r := winrmtest.NewRemote()
	defer r.Close()

	r.CommandFunc(wimrmtest.MatchText("dir C:\Temp"), func(out, err io.Writer) int {
		out.Write([]byte(` Volume in drive C is Windows 2012 R2
 Volume Serial Number is XXXX-XXXX

 Directory of C:\

File Not Found`))
		return 0
	})

	lister := NewDirectoryLister(r.Host, r.Port)
	list, _ := lister.TempDirectory()

	if count := len(list.Dirs()); count != 0 {
		t.Errorf("Expected 0 directories but found %d.\n", count)
	}

	if count := len(list.Files()); count != 0 {
		t.Errorf("Expected 0 files but found %d.\n", count)
	}
}