mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
test(integration): add an integration test for feed removal
This commit is contained in:
parent
13ef89f785
commit
e674dad355
1 changed files with 29 additions and 0 deletions
|
@ -2842,3 +2842,32 @@ func TestFlushHistoryEndpoint(t *testing.T) {
|
|||
t.Fatalf(`Invalid total, got %d`, removedEntries.Total)
|
||||
}
|
||||
}
|
||||
func TestRemoveFeedAsRegularUser(t *testing.T) {
|
||||
testConfig := newIntegrationTestConfig()
|
||||
if !testConfig.isConfigured() {
|
||||
t.Skip(skipIntegrationTestsMessage)
|
||||
}
|
||||
|
||||
adminClient := miniflux.NewClient(testConfig.testBaseURL, testConfig.testAdminUsername, testConfig.testAdminPassword)
|
||||
regularTestUser, err := adminClient.CreateUser(testConfig.genRandomUsername(), testConfig.testRegularPassword, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer adminClient.DeleteUser(regularTestUser.ID)
|
||||
|
||||
regularUserClient := miniflux.NewClient(testConfig.testBaseURL, regularTestUser.Username, testConfig.testRegularPassword)
|
||||
feedID, err := regularUserClient.CreateFeed(&miniflux.FeedCreationRequest{
|
||||
FeedURL: testConfig.testFeedURL,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := regularUserClient.DeleteFeed(feedID); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := regularUserClient.Feed(feedID); err == nil {
|
||||
t.Errorf(`Got a feed (%d) even though it was deleted, was expecting an error instead.`, feedID)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue