delete_groups_request_test.go 811 B

12345678910111213141516171819202122232425262728293031323334
  1. package sarama
  2. import "testing"
  3. var (
  4. emptyDeleteGroupsRequest = []byte{0, 0, 0, 0}
  5. singleDeleteGroupsRequest = []byte{
  6. 0, 0, 0, 1, // 1 group
  7. 0, 3, 'f', 'o', 'o', // group name: foo
  8. }
  9. doubleDeleteGroupsRequest = []byte{
  10. 0, 0, 0, 2, // 2 groups
  11. 0, 3, 'f', 'o', 'o', // group name: foo
  12. 0, 3, 'b', 'a', 'r', // group name: foo
  13. }
  14. )
  15. func TestDeleteGroupsRequest(t *testing.T) {
  16. var request *DeleteGroupsRequest
  17. request = new(DeleteGroupsRequest)
  18. testRequest(t, "no groups", request, emptyDeleteGroupsRequest)
  19. request = new(DeleteGroupsRequest)
  20. request.AddGroup("foo")
  21. testRequest(t, "one group", request, singleDeleteGroupsRequest)
  22. request = new(DeleteGroupsRequest)
  23. request.AddGroup("foo")
  24. request.AddGroup("bar")
  25. testRequest(t, "two groups", request, doubleDeleteGroupsRequest)
  26. }