This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from navikt/story-trim-naisteam
Trim nais-team prefix in recreate story
- Loading branch information
Showing
3 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,6 +297,48 @@ func TestStory(t *testing.T) { | |
} | ||
}) | ||
|
||
t.Run("Recreate story files with token and nais-team prefix", func(t *testing.T) { | ||
storage := postgres.NewStoryStorage(repo) | ||
|
||
updateStory, err := storage.CreateStory(context.Background(), "[email protected]", &service.NewStory{ | ||
Name: "My update story", | ||
Description: strToStrPtr("This is my update story, and it is pretty bad"), | ||
Keywords: []string{"story", "bad"}, | ||
Group: "[email protected]", | ||
}) | ||
assert.NoError(t, err) | ||
|
||
files := map[string]string{ | ||
"index.html": defaultHtml, | ||
"subpage/index.html": "<html><h1>Subpage</h1></html>", | ||
"subsubsubpage/something.html": "<html><h1>Subsubsubpage</h1></html>", | ||
} | ||
|
||
req := CreateMultipartFormRequest( | ||
t, | ||
http.MethodPut, | ||
server.URL+"/quarto/update/"+updateStory.ID.String(), | ||
files, | ||
nil, | ||
map[string]string{ | ||
"Authorization": fmt.Sprintf("Bearer %s", token), | ||
}, | ||
) | ||
|
||
NewTester(t, server). | ||
Send(req). | ||
HasStatusCode(http.StatusNoContent) | ||
|
||
for path, content := range files { | ||
got := NewTester(t, server). | ||
Get("/quarto/" + updateStory.ID.String() + "/" + path). | ||
HasStatusCode(http.StatusOK). | ||
Body() | ||
|
||
assert.Equal(t, content, got) | ||
} | ||
}) | ||
|
||
t.Run("Append story files with token", func(t *testing.T) { | ||
files := map[string]string{ | ||
"newpage/test.html": "<html><h1>New page</h1></html>", | ||
|