Skip to content

Commit a706913

Browse files
pajowurobbi5
authored andcommitted
Add test for offline checkin into filtered checkin lists
1 parent 4214d72 commit a706913

2 files changed

Lines changed: 90 additions & 1 deletion

File tree

libpretixsync/src/test/java/eu/pretix/libpretixsync/check/AsyncCheckProviderTest.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class AsyncCheckProviderTest : BaseDatabaseTest() {
7676
osa.standaloneRefreshFromJSON(jsonResource("orders/order7.json"))
7777
osa.standaloneRefreshFromJSON(jsonResource("orders/order8.json"))
7878
osa.standaloneRefreshFromJSON(jsonResource("orders/order9.json"))
79+
osa.standaloneRefreshFromJSON(jsonResource("orders/order10.json"))
7980
val osa2 = OrderSyncAdapter(db, FakeFileStorage(), "demo2", 0, true, false, fakeApi!!, "", null)
8081
osa2.standaloneRefreshFromJSON(jsonResource("orders/event2-order1.json"))
8182
}
@@ -94,6 +95,18 @@ class AsyncCheckProviderTest : BaseDatabaseTest() {
9495
assertEquals("kfndgffgyw4tdgcacx6bb3bgemq69cxj", qciList[0].secret)
9596
}
9697

98+
@Test
99+
fun testSimpleSuccessFilteredList() {
100+
val r = p!!.check(mapOf("demo" to 10L), "order10_item1_secret_verysecret")
101+
assertEquals(TicketCheckProvider.CheckResult.Type.VALID, r.type)
102+
assertEquals("Regular ticket", r.ticket)
103+
assertEquals(null, r.variation)
104+
105+
val qciList = db.queuedCheckInQueries.selectAll().executeAsList()
106+
assertEquals(1, qciList.size.toLong())
107+
assertEquals("order10_item1_secret_verysecret", qciList[0].secret)
108+
}
109+
97110
@Test
98111
fun testEciClean() {
99112
val r = p!!.check(mapOf("demo" to 1L), "\\000001kfndgffgyw4tdgcacx6bb3bgemq69cxj")
@@ -1017,7 +1030,7 @@ class AsyncCheckProviderTest : BaseDatabaseTest() {
10171030
fun testStatusInfo() {
10181031
val sr = p!!.status("demo", 1L)
10191032
assertEquals("All", sr.eventName)
1020-
assertEquals(19, sr.totalTickets)
1033+
assertEquals(20, sr.totalTickets)
10211034
assertEquals(2, sr.alreadyScanned)
10221035
assertEquals(3, sr.items!!.size)
10231036
val i = sr.items!![0]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"code": "ABC10",
3+
"status": "p",
4+
"testmode": false,
5+
"secret": "order10secret_verysecret",
6+
"email": "order10@examples.com",
7+
"locale": "en",
8+
"datetime": "2019-01-01T00:00:55Z",
9+
"expires": "2020-03-03T16:50:46.773161Z",
10+
"payment_date": null,
11+
"payment_provider": "banktransfer",
12+
"fees": [],
13+
"total": "35.00",
14+
"comment": "",
15+
"invoice_address": null,
16+
"positions": [
17+
{
18+
"id": 27427,
19+
"order": "ABC10",
20+
"positionid": 1,
21+
"item": 42,
22+
"variation": 2,
23+
"price": "23.00",
24+
"attendee_name": "Attendee 10",
25+
"attendee_name_parts": {
26+
"_scheme": "full",
27+
"full_name": "Attendee 10"
28+
},
29+
"attendee_email": null,
30+
"voucher": null,
31+
"tax_rate": "0.00",
32+
"tax_value": "0.00",
33+
"secret": "order10_item1_secret_verysecret",
34+
"addon_to": null,
35+
"subevent": null,
36+
"checkins": [
37+
{
38+
"id": 1,
39+
"datetime": "2019-03-04T17:34:38.221090Z",
40+
"list": 9
41+
}
42+
],
43+
"downloads": [],
44+
"answers": [],
45+
"tax_rule": null,
46+
"pseudonymization_id": "ORDER10IT1"
47+
}
48+
],
49+
"downloads": [],
50+
"checkin_attention": false,
51+
"last_modified": "2019-04-02T07:01:49.735632Z",
52+
"payments": [
53+
{
54+
"local_id": 1,
55+
"state": "confirmed",
56+
"amount": "35.00",
57+
"created": "2019-03-04T16:30:39.084282Z",
58+
"payment_date": null,
59+
"provider": "banktransfer"
60+
}
61+
],
62+
"refunds": [
63+
{
64+
"local_id": 1,
65+
"state": "created",
66+
"source": "admin",
67+
"amount": "35.00",
68+
"payment": null,
69+
"created": "2019-04-02T07:01:51.449258Z",
70+
"execution_date": null,
71+
"provider": "manual"
72+
}
73+
],
74+
"require_approval": false,
75+
"sales_channel": "web"
76+
}

0 commit comments

Comments
 (0)