dapplo / Dapplo.Jira

This is a simple REST based JIRA client, written for Greenshot, by using Dapplo.HttpExtension
MIT License
35 stars 14 forks source link

Support for IssueField "SecurityLevel" #56

Closed toertchn closed 3 years ago

toertchn commented 3 years ago

Would be also great if you can add the security entitiy to the IssueFields.

API@ api/2/project/{projectKeyOrId}/securitylevel

namespace Dapplo.Jira.Entities
{
  /// <summary>
  ///     Security level information
  /// </summary>
  [JsonObject]
  public class SecurityLevel : BaseProperties<long>
  {
    /// <summary>
    ///     Description for the security level
    /// </summary>
    [JsonProperty("description")]
    public string Description { get; set; }

    /// <summary>
    ///     Name of the security level
    /// </summary>
    [JsonProperty("name")]
    public string Name { get; set; }
  }
}

public class IssueFields
{
  /// <summary>
  ///     Security level for this issue
  /// </summary>
  [JsonProperty("security")]
  public SecurityLevel Security { get; set; }
}
Lakritzator commented 3 years ago

Don't know why I didn't add this yet 🤷‍♂️ I guess nobody needed this yet.

I'll try to add it today. but with my kid it's not always easy... 😉

Lakritzator commented 3 years ago

So I just finished adding this, but to be honest I'm not sure how to test this. I know JIRA quite well, but I can remember anything with security levels...

My unit test currently just checks if the call works, but there are no results.

Maybe you can have a look at it? The new method was added in the project domain, and called GetSecurityLevelsAsync https://github.com/dapplo/Dapplo.Jira/blob/master/src/Dapplo.Jira.Tests/ProjectTests.cs#L59

The version I created is 1.1.27

toertchn commented 3 years ago

TestGetSecurityLevelsAsync() works. I got our five entries. Also GetIssue works to get the SecurityLevel.

By the way ... can you also define the projectKey and User/Pass directly in the TestBase class?

Lakritzator commented 3 years ago

Thanks for the feedback!

I've added a project key in the TestBase class, the user and password are already in there but are retrieved via environment variables, as I don't want to have these in my code. Don't want people to start using my dapplo test user 😉