-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors_integration_test.go
130 lines (127 loc) · 4.75 KB
/
errors_integration_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//go:build integration
// nolint:errcheck
package libwekan
import (
"context"
"github.com/stretchr/testify/assert"
"go.mongodb.org/mongo-driver/bson"
"testing"
)
func TestErrors_UpstreamDeadlineExceeded(t *testing.T) {
badWekan := newTestBadWekan("notAWekanDB")
errs := []error{
badWekan.AddMemberToBoard(ctx, "", BoardMember{}), // 0
badWekan.AddMemberToCard(ctx, Card{}, User{}, User{}),
badWekan.AddLabelToCard(ctx, "", ""),
badWekan.AssertPrivileged(ctx),
badWekan.CheckDocuments(ctx, UserID("")),
badWekan.DisableBoardMember(ctx, "", ""),
badWekan.DisableUser(ctx, User{}),
badWekan.DisableUsers(ctx, Users{User{}}),
badWekan.EnableBoardMember(ctx, "", ""),
badWekan.EnableUser(ctx, User{}),
badWekan.EnableUsers(ctx, Users{User{}}),
badWekan.InsertAction(ctx, Action{}),
badWekan.InsertBoard(ctx, Board{}),
badWekan.InsertBoardLabel(ctx, Board{}, BoardLabel{}),
badWekan.InsertCard(ctx, Card{}),
badWekan.InsertList(ctx, List{}),
badWekan.InsertRule(ctx, Rule{}),
badWekan.InsertSwimlane(ctx, Swimlane{}),
badWekan.InsertTemplates(ctx, UserTemplates{}),
badWekan.InsertTrigger(ctx, Trigger{}),
badWekan.InsertUser(ctx, User{}),
badWekan.InsertUsers(ctx, Users{User{}}),
badWekan.RemoveMemberFromCard(ctx, Card{}, User{}, User{}),
badWekan.RemoveRuleWithID(ctx, ""),
ActivityID("").Check(ctx, &badWekan),
BoardID("").Check(ctx, &badWekan),
CardID("").Check(ctx, &badWekan),
ListID("").Check(ctx, &badWekan),
RuleID("").Check(ctx, &badWekan),
SwimlaneID("").Check(ctx, &badWekan),
}
var err error
_, err = ActivityID("").GetDocument(ctx, &badWekan) // 30
errs = append(errs, err)
_, err = BoardID("").GetDocument(ctx, &badWekan)
errs = append(errs, err)
_, err = CardID("").GetDocument(ctx, &badWekan)
errs = append(errs, err)
_, err = ListID("").GetDocument(ctx, &badWekan)
errs = append(errs, err)
_, err = RuleID("").GetDocument(ctx, &badWekan)
errs = append(errs, err)
_, err = SwimlaneID("").GetDocument(ctx, &badWekan)
errs = append(errs, err)
_, err = badWekan.GetActivityFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetBoardFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetBoardFromSlug(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetBoardFromTitle(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetCardFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetListFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetSwimlaneFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetSwimlanesFromBoardID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetUserFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetUserFromUsername(ctx, "")
errs = append(errs, err)
_, err = badWekan.GetUsers(ctx)
errs = append(errs, err)
_, err = badWekan.GetUsersFromIDs(ctx, []UserID{""})
errs = append(errs, err)
_, err = badWekan.GetUsersFromUsernames(ctx, []Username{""})
errs = append(errs, err)
_, err = badWekan.SelectActivitiesFromBoardID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectActivitiesFromQuery(ctx, bson.M{})
errs = append(errs, err)
_, err = badWekan.GetActivityFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectBoardsFromMemberID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectCardsFromBoardID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectCardsFromListID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectCardsFromQuery(ctx, bson.M{})
errs = append(errs, err)
_, err = badWekan.SelectCardsFromUserID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectDomainBoards(ctx)
errs = append(errs, err)
_, err = badWekan.SelectListsFromBoardID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectRuleFromID(ctx, "")
errs = append(errs, err)
_, err = badWekan.SelectRulesFromBoardID(ctx, "")
errs = append(errs, err)
_, err = badWekan.EnsureMemberInCard(ctx, Card{}, User{}, User{})
errs = append(errs, err)
_, err = badWekan.EnsureMemberOutOfCard(ctx, Card{}, User{}, User{})
errs = append(errs, err)
_, err = badWekan.EnsureUserIsBoardAdmin(ctx, "", "")
errs = append(errs, err)
_, err = badWekan.EnsureRuleAddTaskforceMemberExists(ctx, User{}, Board{}, BoardLabel{})
errs = append(errs, err)
_, err = badWekan.EnsureRuleRemoveTaskforceMemberExists(ctx, User{}, Board{}, BoardLabel{})
errs = append(errs, err)
_, err = badWekan.EnsureUserIsActiveBoardMember(ctx, "", "")
errs = append(errs, err)
_, err = badWekan.EnsureUserIsInactiveBoardMember(ctx, "", "")
errs = append(errs, err)
_, err = badWekan.EnsureUserIsInactiveBoardMember(ctx, "", "")
errs = append(errs, err)
for i, err := range errs {
assert.ErrorAs(t, err, &UnexpectedMongoError{}, "l'étape %d a échoué", i)
assert.ErrorIs(t, err, context.DeadlineExceeded, "l'étape %d a échoué", i)
}
}