Skip to content

Commit ab659e0

Browse files
committed
test(indico_ingestor): added tests
1 parent 5263990 commit ab659e0

5 files changed

Lines changed: 131 additions & 220 deletions

File tree

lib/ingestors/indico_ingestor.rb

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def assign_basic_info(event, calevent)
106106
event.url = calevent.url.to_s
107107
event.title = calevent.summary.to_s
108108
event.description = calevent.description.to_s
109-
event.keywords = process_keywords(calevent.categories)
109+
event.keywords = calevent.categories.flatten
110110
event.contact = calevent.contact.join(', ')
111111
end
112112

@@ -125,7 +125,6 @@ def assign_location_info(event, calevent)
125125
event.venue = location.to_s
126126
event.online = calevent.description.include?('zoom')
127127
event.presence = calevent.description.include?('zoom') ? :hybrid : :onsite # can do best, but sufficient for now
128-
event.city, event.postcode, event.country = process_location(location)
129128
end
130129

131130
# Extracts the timezone identifier (TZID) from an iCalendar event's dtstart field.
@@ -138,20 +137,5 @@ def get_tzid(dtstart)
138137

139138
tzid.is_a?(Array) ? tzid.first.to_s : tzid.to_s
140139
end
141-
142-
# Returns an array of 3 location characteristics: suburb, postcode, country
143-
# Everything is nil if location.blank or location is online
144-
def process_location(location)
145-
return [location['suburb'], location['postcode'], location['country']] if location.is_a?(Array)
146-
147-
[nil, nil, nil]
148-
end
149-
150-
# Returns keywords from the `CATEGORIES` ICal field
151-
def process_keywords(categories)
152-
return [] if categories.blank?
153-
154-
categories.flatten.compact.map { |cat| cat.to_s.strip }
155-
end
156140
end
157141
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BEGIN:VCALENDAR
2+
VERSION:2.0
3+
PRODID:-//CERN//INDICO//EN
4+
BEGIN:VEVENT
5+
SUMMARY:14th HEP C++ Course and Hands-on Training - The Essentials
6+
DTSTART:20260309T080000Z
7+
DTEND:20260313T161500Z
8+
DTSTAMP:20251204T105300Z
9+
UID:indico-event-1617123@indico.cern.ch
10+
CONTACT:name.surname@test.com
11+
DESCRIPTION:speakers and zoom here
12+
LOCATION:CERN
13+
URL:https://indico.cern.ch/event/1617123/
14+
CATEGORIES:TRAINING,EDUCATION
15+
END:VEVENT
16+
END:VCALENDAR
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BEGIN:VCALENDAR
2+
VERSION:2.0
3+
PRODID:-//CERN//INDICO//EN
4+
BEGIN:VEVENT
5+
SUMMARY:14th HEP C++ Course and Hands-on Training - The Essentials
6+
DTSTART:20260309T080000Z
7+
DTEND:20260313T161500Z
8+
DTSTAMP:20251203T150800Z
9+
UID:indico-event-1617123@indico.cern.ch
10+
CONTACT:name.surname@test.com
11+
DESCRIPTION:speakers and zoom here
12+
LOCATION:CERN
13+
URL:https://indico.cern.ch/event/1617123/
14+
END:VEVENT
15+
BEGIN:VEVENT
16+
SUMMARY:HEP C++ Course and Hands-on Training - Stay Informed
17+
DTSTART:20991231T225800Z
18+
DTEND:20991231T225900Z
19+
DTSTAMP:20251203T150800Z
20+
UID:indico-event-1211412@indico.cern.ch
21+
CONTACT:name.surname@test.com
22+
DESCRIPTION:mockdescription
23+
URL:https://indico.cern.ch/event/1211412/
24+
END:VEVENT
25+
END:VCALENDAR
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
3+
<html lang="en"
4+
data-canonical-locale="en-US"
5+
data-static-site="false">
6+
<head>
7+
<title>My Agenda (Indico)</title>
8+
<meta charset="UTF-8">
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
10+
<link rel="shortcut icon" type="image/x-icon" href="/images/indico.ico">
11+
12+
<meta property="og:site_name" content="Agenda (Indico)">
13+
<meta property="og:image" content="https://agenda.com/images/indico_square.png">
14+
15+
</head>
16+
</html>

0 commit comments

Comments
 (0)