aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests2/SelfTest.cs
blob: 9698551a229afa1c65bfa98bc92c68f14a5481f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Timeline.Models.Http;
using Xunit;
using Xunit.Abstractions;

namespace Timeline.Tests.IntegratedTests2
{
    public class SelfTest : IntegratedTestBase
    {
        public SelfTest(ITestOutputHelper testOutput) : base(testOutput)
        {
        }

        [Fact]
        public async Task ChangePassword()
        {
            await DefaultClient.TestJsonSendAsync(HttpMethod.Post, "v2/self/changepassword", new HttpChangePasswordRequest
            {
                OldPassword = "abc",
                NewPassword = "def"
            }, expectedStatusCode: HttpStatusCode.Unauthorized);


            await UserClient.TestJsonSendAsync(HttpMethod.Post, "v2/self/changepassword", new HttpChangePasswordRequest
            {
                OldPassword = "abc",
                NewPassword = "def"
            }, expectedStatusCode: HttpStatusCode.UnprocessableEntity);

            await UserClient.TestJsonSendAsync(HttpMethod.Post, "v2/self/changepassword", new HttpChangePasswordRequest
            {
                OldPassword = "userpw",
                NewPassword = "def"
            }, expectedStatusCode: HttpStatusCode.NoContent);
        }
    }
}