func (s *AgentTestSuite) TestStatusAfterConnFail(t *C) {
	// Use optional ConnectChan in mock ws client for this test only.
	connectChan := make(chan bool)
	s.client.SetConnectChan(connectChan)
	defer s.client.SetConnectChan(nil)

	// Disconnect agent.
	s.client.Disconnect()

	// Wait for agent to reconnect.
	<-connectChan
	connectChan <- true

	// Send cmd.
	statusCmd := &proto.Cmd{
		Ts:   time.Now(),
		User: "******",
		Cmd:  "Status",
	}
	s.sendChan <- statusCmd

	// Get reply.
	got := test.WaitStatusReply(s.recvChan)
	t.Assert(got, NotNil)
	t.Check(got["agent"], Equals, "Idle")
}
func (s *AgentTestSuite) TestStatus(t *C) {

	// This is what the API would send:
	statusCmd := &proto.Cmd{
		Ts:   time.Now(),
		User: "******",
		Cmd:  "Status",
	}
	s.sendChan <- statusCmd

	got := test.WaitStatusReply(s.recvChan)
	t.Assert(got, NotNil)

	expectStatus := map[string]string{
		"agent": "Idle",
	}
	if ok, diff := test.IsDeeply(got, expectStatus); !ok {
		test.Dump(got)
		t.Error(diff)
	}

	// We asked for all status, so we should get mm too.
	_, ok := got["mm"]
	t.Check(ok, Equals, true)

	/**
	 * Get only agent's status
	 */
	statusCmd = &proto.Cmd{
		Ts:      time.Now(),
		User:    "******",
		Cmd:     "Status",
		Service: "agent",
	}
	s.sendChan <- statusCmd
	got = test.WaitStatusReply(s.recvChan)
	t.Assert(got, NotNil)

	// Only asked for agent, so we shouldn't get mm.
	_, ok = got["mm"]
	t.Check(ok, Equals, false)

	/**
	 * Get only sub-service status.
	 */
	statusCmd = &proto.Cmd{
		Ts:      time.Now(),
		User:    "******",
		Cmd:     "Status",
		Service: "mm",
	}
	s.sendChan <- statusCmd
	got = test.WaitStatusReply(s.recvChan)
	t.Assert(got, NotNil)

	// Asked for mm, so we get it.
	_, ok = got["mm"]
	t.Check(ok, Equals, true)

	// Didn't ask for all or agent, so we don't get it.
	_, ok = got["agent"]
	t.Check(ok, Equals, false)
}