diff --git a/net/server/internal/testApp.go b/net/server/internal/testApp.go index b89efbd1..a8df9e98 100644 --- a/net/server/internal/testApp.go +++ b/net/server/internal/testApp.go @@ -72,7 +72,7 @@ func (a *TestApp) UpdateArticle() (err error) { } } else { revision := strconv.FormatInt(a.revision.Article, 10) - params := &TestApiParams{ query: "/articles?revision=" + revision, tokenType: APP_TOKENAPP, token: a.token } + params := &TestApiParams{ query: "/articles?articleRevision=" + revision, tokenType: APP_TOKENAPP, token: a.token } response := &TestApiResponse{ data: &articles } if err = TestApiRequest(GetArticles, params, response); err != nil { return diff --git a/net/server/internal/ucContactApp_test.go b/net/server/internal/ucContactApp_test.go index 6b274e2a..8e1d17a5 100644 --- a/net/server/internal/ucContactApp_test.go +++ b/net/server/internal/ucContactApp_test.go @@ -39,5 +39,34 @@ func TestContactApp(t *testing.T) { return false })) + // add a new article + article := &Article{} + subject := &Subject{ Data: "subjectdata", DataType: "subjectdatatype" } + params := &TestApiParams{ restType: "POST", query: "/articles", tokenType: APP_TOKENAPP, token: set.A.Token, body: subject } + response := &TestApiResponse{ data: article } + assert.NoError(t, TestApiRequest(AddArticle, params, response)) + + // wait for a + assert.NoError(t, app.WaitFor(func(testApp *TestApp)bool { + a, set := testApp.articles[article.Id] + if set && a.Data.Data == "subjectdata" { + return true + } + return false + })) + + // remove a new article + params = &TestApiParams{ restType: "DELETE", query: "/articles/{articleId}", path: map[string]string{ "articleId": article.Id }, + tokenType: APP_TOKENAPP, token: set.A.Token, body: subject } + response = &TestApiResponse{} + assert.NoError(t, TestApiRequest(RemoveArticle, params, response)) + + // wait for a to be removed + assert.NoError(t, app.WaitFor(func(testApp *TestApp)bool { + if _, set := testApp.articles[article.Id]; !set { + return true + } + return false + })) }