-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial release #1
base: main
Are you sure you want to change the base?
Conversation
Tests/Get-YTProject.Tests.ps1
Outdated
It 'returns one project' { | ||
GivenProject -ShortName 'GYTP1' -Name 'Get-YTProject Test Project' -Leader 'admin' | ||
WhenGettingProject -ProjectShortName 'DEMO' | ||
ThenProjectsReturned -GreaterThanEqual 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would combine the two ThenProject*
functions into a single ThenReturns
function:
ThenReturns -Count 2
ThenReturns -ProjectWithShortName 'DEMO'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use GreaterThanEqual
. Use an exact count. If you use greater than or equal to, if the API returns more than expected, tests will still pass.
Tests/Get-YTProject.Tests.ps1
Outdated
It 'return all projects' { | ||
WhenGettingProject | ||
ThenProjectsReturned -GreaterThanEqual 2 | ||
ThenProjectWithShortName -ShortName 'DEMO' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert both projects that get returned.
Tests/New-YTIssue.Tests.ps1
Outdated
} | ||
|
||
It 'should create a new issue' { | ||
GivenSummary 'First YTAutomation Issue' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove tall these Given
functions. Given
functions should, in general, be used to setup the state of the system. These are better as parameters on WhenCreatingIssue
.
WhenCreatingIssue -WithSummary '' -WithDescription '' -InProject ''
Tests/New-YTIssue.Tests.ps1
Outdated
GivenDescription 'This is the first issue created by the YouTrackAutomation module.' | ||
GivenProjectShortName 'NYTI' | ||
WhenCreatingIssue | ||
ThenIssue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parameter users have to pass to assert the issue:
ThenIssue -Created -WithSummary '' -WithDescription '' -InProject ''
ThenIssue
should make a call to YouTrack to get the issue.
|
||
# The project that the issue will be created in. This should be the short name of the project. | ||
[Parameter(Mandatory)] | ||
[String] $Project, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to make as few web requests as possible, so either change this to ProjectID
or allow users to pass a project object, short name, or ID. For the second object, change its type to Object
then create a Resolve-YTProject
function that handles that:
if ($Project | Get-Member -Name 'id')
{
return $Project.id
}
if ($Project -is [int] -or $Project -match '^\d+$' )
{
return Get-YTProject -Session $Session -ID $Project
}
if ($Project -is [String])
{
return Get-YTProject -Session $Session -ShortName $Project
}
Write-Error "Failed to resolve project ""${Project}"": expected an object with an `id` property, an integer ID, or a project short name."
|
||
if ($Template) | ||
{ | ||
$fields += "&template=$Template" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encode $Template
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump.
@@ -18,7 +18,7 @@ | |||
RootModule = 'YouTrackAutomation.psm1' | |||
|
|||
# Version number of this module. | |||
ModuleVersion = '0.0.0' | |||
ModuleVersion = '0.1.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.0.0
.
…and parameters for all functions
@@ -73,6 +74,10 @@ Build: | |||
- PublishPowerShellModule: | |||
Path: YouTrackAutomation | |||
|
|||
- PowerShell: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call reset.ps1
instead.
But consider removing? Do we really need to clean up on the build server? The VM we're using is going to get reaped by AppVeyor...
init.ps1
Outdated
Invoke-WebRequest -Uri "https://download-cdn.jetbrains.com/charisma/youtrack-${YouTrackVersion}.zip" -OutFile $archivePath | ||
} | ||
|
||
$dataArchivePath = Join-Path -Path $PSScriptRoot -ChildPath 'ytconfig.zip' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check these files into source loose, not as a ZIP file. If/when we ever need to update them, we'll have to unzip this file, update them, then zip the file back up again. It makes it hard to see what changed with the config and why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we just commit the files we change/care about to get YT running/working.
init.ps1
Outdated
@@ -6,6 +7,9 @@ Gets your computer ready to develop the YouTrackAutomation module. | |||
The init.ps1 script makes the configuraion changes necessary to get your computer ready to develop for the | |||
YouTrackAutomation module. It: | |||
|
|||
* Installs YouTrack to the current folder from an pre-configured YouTrack instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/an/a/
@@ -6,6 +7,9 @@ Gets your computer ready to develop the YouTrackAutomation module. | |||
The init.ps1 script makes the configuraion changes necessary to get your computer ready to develop for the | |||
YouTrackAutomation module. It: | |||
|
|||
* Installs YouTrack to the current folder from an pre-configured YouTrack instance. | |||
* Configures the YouTrack instance to use the default port of 8080 and listen on 'localhost'. | |||
* Sets up the default user account with the username 'admin' and password 'admin'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to generate a random password? Typically, I'll save the password to a .password file that gets ignored by source control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look to me like that is possible. I'll keep looking though.
Gets an issue from YouTrack. | ||
|
||
.DESCRIPTION | ||
The `Get-YTIssue` function gets an issue from YouTrack using the issue ID or issue key. The function returns the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump.
$fields += ",$($AdditionalField -join ',')" | ||
} | ||
|
||
$fields = [Uri]::EscapeUriString($fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be [Uri]::EscapeDataString($fields)
.
[String] $Template, | ||
|
||
# Additional fields to include in the response. | ||
[String[]] $AdditionalFields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint: parameter names should be singular.
$apiToken = 'perm:YWRtaW4=.NDctMA==.MskXiizMXwymP1Kfm21iR14len99jp' | ||
$apiUrl = 'http://localhost:8080' | ||
|
||
function Remove-AllProjects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to Clear-Project
.
c01364c
to
0f1c7c3
Compare
c21f75c
to
4532698
Compare
ebae5fa
to
f7ceb28
Compare
Please automate the download and updating of the YouTrackConfig directory. It should not be getting checked into source. |
Gets an issue from YouTrack. | ||
|
||
.DESCRIPTION | ||
The `Get-YTIssue` function gets an issue from YouTrack using the issue ID or issue key. The function returns the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to get done.
$fields += ",$($AdditionalField -join ',')" | ||
} | ||
|
||
$fields = [Uri]::EscapeUriString($fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to change.
Invokes a REST method in YouTrack. | ||
|
||
.DESCRIPTION | ||
The `Invoke-YTRestMethod` function invokes a REST method in YouTrack using the provided session object. Pass in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump.
|
||
if ($Template) | ||
{ | ||
$fields += "&template=$Template" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump.
$fields += "&template=$Template" | ||
} | ||
|
||
$fields = [Uri]::EscapeUriString($fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump.
The `Resolve-YTProjectId` function takes in a project, project short name, or project id and returns the project id | ||
associated with the project provided. | ||
|
||
.EXAMPLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function name in examples is wrong.
.EXAMPLE | ||
Resolve-YTProject.ps1 -Session $session -Project $project | ||
|
||
Demonstrates resolving the project id for the project with a project object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump.
0e41434
to
3f058e7
Compare
Adding the following functions:
Get-YTIssue
Get-YTProject
Invoke-YTRestMethod
New-YTIssue
New-YTProject
New-YTSession