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); }
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); }
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); }
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); }
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); }
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); }
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; }
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); }