add tests for functionality

This commit is contained in:
Chelsea Holland Komlo
2017-10-04 14:46:47 -04:00
committed by Alex Dadgar
parent fba1653057
commit 38f8217ea0
2 changed files with 64 additions and 0 deletions

View File

@@ -316,6 +316,24 @@ func TestHTTP_AllocSnapshot(t *testing.T) {
})
}
func TestHTTP_AllocSnapshot_WithMigrateToken(t *testing.T) {
t.Parallel()
assert := assert.New(t)
httpACLTest(t, nil, func(s *TestAgent) {
// TODO add an allocation, assert it is returned
// Request without a token succeeds
req, err := http.NewRequest("GET", "/v1/client/allocation/123/snapshot", nil)
assert.Nil(err)
// Make the unauthorized request
respW := httptest.NewRecorder()
_, err = s.Server.ClientAllocRequest(respW, req)
assert.NotNil(err)
assert.Contains(err.Error(), "invalid migrate token")
})
}
func TestHTTP_AllocGC(t *testing.T) {
t.Parallel()
httpTest(t, nil, func(s *TestAgent) {