@@ -49,10 +49,9 @@ func TestListNamespaces(t *testing.T) {
49
49
},
50
50
ctx : ctx ,
51
51
requiredMocks : func () {
52
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
53
52
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
54
53
storeMock .
55
- On ("NamespaceList" , ctx , query.Paginator {Page : 1 , PerPage : 10 }, query.Filters {}, mock .AnythingOfType ("store.NamespaceQueryOption" ), mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
54
+ On ("NamespaceList" , ctx , query.Paginator {Page : 1 , PerPage : 10 }, query.Filters {}, mock .AnythingOfType ("store.NamespaceQueryOption" )).
56
55
Return (nil , 0 , errors .New ("error" )).
57
56
Once ()
58
57
},
@@ -70,10 +69,9 @@ func TestListNamespaces(t *testing.T) {
70
69
},
71
70
ctx : ctx ,
72
71
requiredMocks : func () {
73
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
74
72
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
75
73
storeMock .
76
- On ("NamespaceList" , ctx , query.Paginator {Page : 1 , PerPage : 10 }, query.Filters {}, mock .Anything , mock . Anything ).
74
+ On ("NamespaceList" , ctx , query.Paginator {Page : 1 , PerPage : 10 }, query.Filters {}, mock .Anything ).
77
75
Return (
78
76
[]models.Namespace {
79
77
{
@@ -225,10 +223,9 @@ func TestGetNamespace(t *testing.T) {
225
223
description : "fails when could not get the namespace" ,
226
224
tenantID : "00000000-0000-4000-0000-000000000000" ,
227
225
requiredMocks : func () {
228
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
229
226
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
230
227
storeMock .
231
- On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock .AnythingOfType ("store.NamespaceQueryOption" ), mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
228
+ On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock .AnythingOfType ("store.NamespaceQueryOption" )).
232
229
Return (nil , errors .New ("error" )).
233
230
Once ()
234
231
},
@@ -241,10 +238,9 @@ func TestGetNamespace(t *testing.T) {
241
238
description : "succeeds - team" ,
242
239
tenantID : "00000000-0000-4000-0000-000000000000" ,
243
240
requiredMocks : func () {
244
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
245
241
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
246
242
storeMock .
247
- On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock .AnythingOfType ("store.NamespaceQueryOption" ), mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
243
+ On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock .AnythingOfType ("store.NamespaceQueryOption" )).
248
244
Return (
249
245
& models.Namespace {
250
246
Name : "group1" ,
@@ -284,10 +280,9 @@ func TestGetNamespace(t *testing.T) {
284
280
description : "succeeds - personal (with have changed to team temporarily)" ,
285
281
tenantID : "00000000-0000-4000-0000-000000000000" ,
286
282
requiredMocks : func () {
287
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
288
283
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
289
284
storeMock .
290
- On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock .AnythingOfType ("store.NamespaceQueryOption" ), mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
285
+ On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock .AnythingOfType ("store.NamespaceQueryOption" )).
291
286
Return (
292
287
& models.Namespace {
293
288
Name : "group1" ,
@@ -1124,10 +1119,9 @@ func TestEditNamespace(t *testing.T) {
1124
1119
On ("NamespaceEdit" , ctx , "xxxxx" , & models.NamespaceChanges {Name : "newname" }).
1125
1120
Return (nil ).
1126
1121
Once ()
1127
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
1128
1122
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
1129
1123
storeMock .
1130
- On ("NamespaceGet" , ctx , "xxxxx" , mock .AnythingOfType ("store.NamespaceQueryOption" ), mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
1124
+ On ("NamespaceGet" , ctx , "xxxxx" , mock .AnythingOfType ("store.NamespaceQueryOption" )).
1131
1125
Return (
1132
1126
& models.Namespace {
1133
1127
TenantID : "xxxxx" ,
@@ -1153,10 +1147,9 @@ func TestEditNamespace(t *testing.T) {
1153
1147
On ("NamespaceEdit" , ctx , "xxxxx" , & models.NamespaceChanges {Name : "newname" }).
1154
1148
Return (nil ).
1155
1149
Once ()
1156
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
1157
1150
queryOptionsMock .On ("EnrichMembersData" ).Return (nil ).Once ()
1158
1151
storeMock .
1159
- On ("NamespaceGet" , ctx , "xxxxx" , mock .AnythingOfType ("store.NamespaceQueryOption" ), mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
1152
+ On ("NamespaceGet" , ctx , "xxxxx" , mock .AnythingOfType ("store.NamespaceQueryOption" )).
1160
1153
Return (
1161
1154
& models.Namespace {
1162
1155
TenantID : "xxxxx" ,
@@ -1195,8 +1188,6 @@ func TestEditNamespace(t *testing.T) {
1195
1188
1196
1189
func TestDeleteNamespace (t * testing.T ) {
1197
1190
storeMock := new (storemock.Store )
1198
- queryOptionsMock := new (storemock.QueryOptions )
1199
- storeMock .On ("Options" ).Return (queryOptionsMock )
1200
1191
1201
1192
ctx := context .TODO ()
1202
1193
@@ -1210,9 +1201,8 @@ func TestDeleteNamespace(t *testing.T) {
1210
1201
description : "fails when namespace does not exist" ,
1211
1202
tenantID : "00000000-0000-4000-0000-000000000000" ,
1212
1203
requiredMocks : func () {
1213
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
1214
1204
storeMock .
1215
- On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
1205
+ On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" ).
1216
1206
Return (nil , errors .New ("error" )).
1217
1207
Once ()
1218
1208
},
@@ -1222,9 +1212,8 @@ func TestDeleteNamespace(t *testing.T) {
1222
1212
description : "fails when store delete fails" ,
1223
1213
tenantID : "00000000-0000-4000-0000-000000000000" ,
1224
1214
requiredMocks : func () {
1225
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
1226
1215
storeMock .
1227
- On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
1216
+ On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" ).
1228
1217
Return (& models.Namespace {TenantID : "00000000-0000-4000-0000-000000000000" }, nil ).
1229
1218
Once ()
1230
1219
envMock .
@@ -1246,9 +1235,8 @@ func TestDeleteNamespace(t *testing.T) {
1246
1235
description : "succeeds" ,
1247
1236
tenantID : "00000000-0000-4000-0000-000000000000" ,
1248
1237
requiredMocks : func () {
1249
- queryOptionsMock .On ("CountAcceptedDevices" ).Return (nil ).Once ()
1250
1238
storeMock .
1251
- On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" , mock . AnythingOfType ( "store.NamespaceQueryOption" ) ).
1239
+ On ("NamespaceGet" , ctx , "00000000-0000-4000-0000-000000000000" ).
1252
1240
Return (& models.Namespace {TenantID : "00000000-0000-4000-0000-000000000000" }, nil ).
1253
1241
Once ()
1254
1242
envMock .
0 commit comments