Skip to content

Commit

Permalink
fix naming test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall committed Jul 17, 2024
1 parent aecdf5b commit aa3e015
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions sonarr/naming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const namingBody = `{
"seriesFolderFormat": "{Series Title}",
"seasonFolderFormat": "Season {season}",
"specialsFolderFormat": "Specials",
"customcolonReplacementFormat": "",
"id": 1
}`

Expand Down Expand Up @@ -85,10 +86,23 @@ func TestUpdateNaming(t *testing.T) {
ExpectedMethod: "PUT",
ResponseStatus: 202,
WithRequest: &sonarr.Naming{
ReplaceIllegalCharacters: true,
RenameEpisodes: true,
ReplaceIllegalCharacters: true,
ColonReplacementFormat: 5,
ID: 4,
MultiEpisodeStyle: 2,
DailyEpisodeFormat: "a",
AnimeEpisodeFormat: "b",
SeriesFolderFormat: "c",
SeasonFolderFormat: "d",
SpecialsFolderFormat: "e",
StandardEpisodeFormat: "f",
CustomColonReplacementFormat: "g",
},
ExpectedRequest: `{"replaceIllegalCharacters":true,"id":1}` + "\n",
ResponseBody: namingBody,
ExpectedRequest: `{"renameEpisodes":true,"replaceIllegalCharacters":true,"colonReplacementFormat":5,` +
`"id":1,"multiEpisodeStyle":2,"dailyEpisodeFormat":"a","animeEpisodeFormat":"b","seriesFolderFormat":"c",` +
`"seasonFolderFormat":"d","specialsFolderFormat":"e","standardEpisodeFormat":"f","customColonReplacementFormat":"g"}` + "\n",
ResponseBody: namingBody,
WithResponse: &sonarr.Naming{
ID: 1,
RenameEpisodes: false,
Expand All @@ -103,18 +117,21 @@ func TestUpdateNaming(t *testing.T) {
},
WithError: nil,
},

{
Name: "404",
ExpectedPath: path.Join("/", starr.API, sonarr.APIver, "config", "naming"),
ExpectedMethod: "PUT",
WithRequest: &sonarr.Naming{
ReplaceIllegalCharacters: true,
},
ExpectedRequest: `{"replaceIllegalCharacters":true,"id":1}` + "\n",
ResponseStatus: 404,
ResponseBody: `{"message": "NotFound"}`,
WithError: &starr.ReqError{Code: http.StatusNotFound},
WithResponse: (*sonarr.Naming)(nil),
ExpectedRequest: `{"renameEpisodes":false,"replaceIllegalCharacters":true,"colonReplacementFormat":0,` +
`"id":1,"multiEpisodeStyle":0,"dailyEpisodeFormat":"","animeEpisodeFormat":"","seriesFolderFormat":"",` +
`"seasonFolderFormat":"","specialsFolderFormat":"","standardEpisodeFormat":"","customColonReplacementFormat":""}` + "\n",
ResponseStatus: 404,
ResponseBody: `{"message": "NotFound"}`,
WithError: &starr.ReqError{Code: http.StatusNotFound},
WithResponse: (*sonarr.Naming)(nil),
},
}

Expand Down

0 comments on commit aa3e015

Please sign in to comment.