Tests that Set returns a copy of addr with attributes containing correct user and connect address.
(t *testing.T)
| 95 | // Tests that Set returns a copy of addr with attributes containing correct |
| 96 | // user and connect address. |
| 97 | func (s) TestSet(t *testing.T) { |
| 98 | addr := resolver.Address{Addr: "test-address"} |
| 99 | pOpts := Options{ |
| 100 | User: url.UserPassword("username", "password"), |
| 101 | ConnectAddr: "proxy-address", |
| 102 | } |
| 103 | |
| 104 | // Call Set and validate attributes |
| 105 | populatedAddr := Set(addr, pOpts) |
| 106 | gotOption, attrPresent := Get(populatedAddr) |
| 107 | if !attrPresent { |
| 108 | t.Errorf("Get(%v) = %v, want %v ", populatedAddr, attrPresent, true) |
| 109 | } |
| 110 | if got, want := gotOption.ConnectAddr, pOpts.ConnectAddr; got != want { |
| 111 | t.Errorf("unexpected ConnectAddr proxy atrribute = %v, want %v", got, want) |
| 112 | } |
| 113 | if got, want := gotOption.User, pOpts.User; got != want { |
| 114 | t.Errorf("unexpected User proxy attribute = %v, want %v", got, want) |
| 115 | } |
| 116 | } |