Skip to content

Commit

Permalink
Add Reddit, Pintrest, YouTube, Facebook, and LinkedIn extra fields (#80)
Browse files Browse the repository at this point in the history
Corresponds to the new fields added from
cncf/landscape2#759

---------

Signed-off-by: John Mertic <[email protected]>
  • Loading branch information
jmertic authored Dec 2, 2024
1 parent f054b19 commit 9fc9b74
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lfx_landscape_tools/lfxprojects.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def loadData(self):
member.crunchbase = record.get('CrunchBaseUrl',self.defaultCrunchbase)
member.linkedin = record.get('LinkedIn')
member.twitter = record.get('Twitter')
extra['facebook_url'] = record.get('Facebook')
extra['reddit_url'] = record.get('Reddit')
extra['pinterest_url'] = record.get('Pinterest')
extra['youtube_url'] = record.get('YouTube')
if self.addPMOManagedStatus and record.get('HasProgramManager'):
second_path.append('PMO Managed / All')
if self.addIndustrySector and record.get('IndustrySector') != '':
Expand Down
6 changes: 6 additions & 0 deletions lfx_landscape_tools/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ def toLandscapeItemAttributes(self):
if returnentry.get('crunchbase'):
del returnentry['crunchbase']

if self.linkedin:
logging.getLogger().info("Setting 'extra.linkedin_url' to '{}' for '{}'".format(self.linkedin,self.orgname))
if not returnentry['extra']:
returnentry['extra'] = {}
returnentry['extra']['linkedin_url'] = self.linkedin

return returnentry

def isValidLandscapeItem(self):
Expand Down
10 changes: 10 additions & 0 deletions test/test_lfxprojects.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def testLoadData(self):
"Motion Pictures"
],
"IndustrySector": "Motion Pictures",
"Facebook": "https://www.facebook.com/TheLinuxFoundation",
"LinkedIn": "https://www.linkedin.com/company/208777",
"Reddit": "https://www.reddit.com/r/vfx/",
"Pinterest": "https://www.pinterest.com/linuxfoundation/",
"YouTube": "https://www.youtube.com/user/TheLinuxFoundation",
"Name": "OpenCue",
"ParentID": "a09410000182dD2AAI",
"ParentSlug": "aswf",
Expand Down Expand Up @@ -780,6 +785,11 @@ def testLoadData(self):
members.loadData()
self.assertEqual(members.members[0].orgname,"OpenCue")
self.assertEqual(members.members[0].crunchbase,"https://www.crunchbase.com/organization/linux-foundation")
self.assertEqual(members.members[0].extra["facebook_url"],"https://www.facebook.com/TheLinuxFoundation")
self.assertEqual(members.members[0].linkedin,"https://www.linkedin.com/company/208777")
self.assertEqual(members.members[0].extra["reddit_url"],"https://www.reddit.com/r/vfx/")
self.assertEqual(members.members[0].extra["pinterest_url"],"https://www.pinterest.com/linuxfoundation/")
self.assertEqual(members.members[0].extra["youtube_url"],"https://www.youtube.com/user/TheLinuxFoundation")
self.assertEqual(members.members[0].logo,"opencue.svg")
self.assertEqual(members.members[0].membership,"All")
self.assertEqual(members.members[0].website,"https://opencue.io/")
Expand Down
4 changes: 4 additions & 0 deletions test/test_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ def testToLandscapeItemAttributesEmptyCrunchbase(self):
member.orgname = 'test'
member.website = 'https://foo.com'
member.membership = 'Gold'
member.linkedin = 'https://www.linkedin.com/company/208777'
dict = member.toLandscapeItemAttributes()

self.assertEqual(dict.get('name'),member.orgname)
self.assertEqual(dict.get('homepage_url'),member.website)
self.assertEqual(dict.get('organization',{}).get('name'),member.orgname)
self.assertEqual(dict.get('organization',{}).get('linkedin'),member.linkedin)
self.assertIsNone(dict.get('logo'))
self.assertIsNone(dict.get('item'))
self.assertNotIn('crunchbase',dict)
Expand All @@ -241,11 +243,13 @@ def testToLandscapeItemAttributesWithSuffix(self):
member.website = 'https://foo.com'
member.membership = 'Gold'
member.crunchbase = 'https://www.crunchbase.com/organization/visual-effects-society'
member.linkedin = 'https://www.linkedin.com/company/208777'
dict = member.toLandscapeItemAttributes()

self.assertEqual(dict.get('name'),member.orgname+" (testme)")
self.assertEqual(dict.get('homepage_url'),member.website)
self.assertEqual(dict.get('crunchbase'),member.crunchbase)
self.assertEqual(dict.get('extra',{}).get('linkedin_url'),member.linkedin)
self.assertIsNone(dict.get('logo'))
self.assertIsNone(dict.get('item'))
self.assertNotIn('membership',dict)
Expand Down

0 comments on commit 9fc9b74

Please sign in to comment.