Exemplo n.º 1
0
        public async Task CreateAndAuthenticate()
        {
            _client = new CdnClient(Constants.BaseUrl);
            var resp = await _client.Login("admin", "password");

            Assert.IsTrue(resp.HasValue);
            Assert.IsNotEmpty(resp.Value.Token);
        }
Exemplo n.º 2
0
        public async Task LoginTest()
        {
            using var client = new CdnClient(Constants.BaseUrl);
            var loginDto = await client.Login("admin", "password");

            Assert.IsTrue(loginDto.HasValue);
            Assert.AreEqual("admin", loginDto.Value.User.Username);
            Assert.IsNotNull(loginDto.Value.Token);
            Assert.IsNotEmpty(loginDto.Value.Token);
        }
Exemplo n.º 3
0
        public async Task LoginAuthTest()
        {
            using var client = new CdnClient(Constants.BaseUrl);
            await client.Login("admin", "password");

            (bool success, string message) = await client.TestAuthentication();

            Assert.IsTrue(success);
            Assert.IsNotEmpty(message);
        }
Exemplo n.º 4
0
        public async Task TestRemoveApiKey()
        {
            using var client = new CdnClient(Constants.BaseUrl);
            await client.Login("admin", "password");

            var tokenMaybe = await client.GetApiKey();

            Assert.IsTrue(tokenMaybe.HasValue);
            Assert.IsNotEmpty(tokenMaybe.Value);
            await client.DeleteApiKey();

            Assert.AreEqual(AuthenticationType.Jwt, client.CurrentAuthenticationType);
        }
Exemplo n.º 5
0
        public async Task GetApiKeyAndTestAuthentication()
        {
            using var client = new CdnClient(Constants.BaseUrl);
            await client.Login("admin", "password");

            var tokenMaybe = await client.GetApiKey();

            Assert.IsTrue(tokenMaybe.HasValue);
            Assert.IsNotEmpty(tokenMaybe.Value);
            (bool success, string message) = await client.TestAuthentication();

            Assert.IsTrue(success);
            Assert.IsNotEmpty(message);
        }
Exemplo n.º 6
0
        public async Task CreateAndAuthenticate()
        {
            _client = new CdnClient(Constants.BaseUrl);
            var resp = await _client.Login("admin", "password");

            Assert.IsTrue(resp.HasValue);
            Assert.IsNotEmpty(resp.Value.Token);

            // Create an album that is going to be deleted
            _albumToBeDeleted = (await _client.CreateAlbum("testAlbum").ConfigureAwait(false)).Value;
            Assert.NotNull(_albumToBeDeleted);
            _albumUsedForTestingPrivate = (await _client.CreateAlbum("testAlbum2", false).ConfigureAwait(false)).Value;
            Assert.NotNull(_albumUsedForTestingPrivate);
            _albumUsedForTesting = (await _client.CreateAlbum("testAlbum123").ConfigureAwait(false)).Value;
            Assert.NotNull(_albumUsedForTesting);
        }
Exemplo n.º 7
0
        public async Task CreateAndAuthenticate()
        {
            _client = new CdnClient(Constants.BaseUrl);
            var resp = await _client.Login("admin", "password");

            Assert.IsTrue(resp.HasValue);
            Assert.IsNotEmpty(resp.Value.Token);
            // Add dummy user to remove
            var userToRemove = await _client.Register("removeMePlease", "password");

            var userToRename = await _client.Register("changeMyName", "password");

            Assert.IsTrue(userToRemove.HasValue);
            Assert.IsTrue(userToRename.HasValue);
            _userToRemove = userToRemove.Value;
            _userToRename = userToRename.Value;
        }
Exemplo n.º 8
0
        public async Task CreateAndAuthenticate()
        {
            _client = new CdnClient(Constants.BaseUrl);
            var resp = await _client.Login("admin", "password");

            Assert.IsTrue(resp.HasValue);
            Assert.IsNotEmpty(resp.Value.Token);

            // Upload files to be used in further tests
            _uploadedFiles = (await this.UploadMultipleFilesNoParameters().ConfigureAwait(false)).ToList();
            // Upload one private file
            var file = await _client.UploadFile(FileUploadTests.GetExampleImage(), "privateTestfile", false);

            Assert.IsTrue(file.HasValue);
            Assert.NotNull(file.Value);
            _uploadedFiles.Add(file.Value);
            Assert.IsNotEmpty(_uploadedFiles);
        }