public APITests()
 {
     _http  = new HttpTest();
     client = new HarborClient("http://localhost:5555/", LoginBehavior.Probe);
     _http.RespondWithJson(new SystemInfo {
         Version = "v1.6.3-abcdef12"
     });
 }
        public async Task CanLoginOn170WhenForced(string token, string user, string password)
        {
            _http.ResponseQueue.Clear();
            _http.RespondWith("", cookies: new { sid = token });

            var sut = new HarborClient("http://localhost:5555/", LoginBehavior.ForcePost17);
            await sut.Login(user, password);

            Assert.Equal(token, sut.SessionToken);
            _http.ShouldHaveCalled("*/c/login").WithVerb(HttpMethod.Post).WithRequestBody($"principal={user}&password={password}").Times(1);
            _http.ShouldNotHaveCalled("*/api/systeminfo");
        }
Exemplo n.º 3
0
 public APITests()
 {
     _http  = new HttpTest();
     client = new HarborClient("http://localhost:5555/");
 }