Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show representative website and social media links
On the page to call U.S. representatives, show links to their website and social media accounts. This may be useful for looking up alternative contact information if you can't contact the rep via the given phone number. Closes #4 #4
- Loading branch information
Showing
4 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,90 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. | ||
from meetings.models import Division, Office, Official, SocialMediaChannel | ||
|
||
class SocialMediaChannelTestCase(TestCase): | ||
def setUp(self): | ||
division = Division.objects.create( | ||
ocd_id="ocd-division/country:us/state:ky/cd:5", | ||
name="Kentucky's 5th congressional district", | ||
) | ||
office = Office.objects.create( | ||
name="United States House of Representatives KY-05", | ||
division=division, | ||
) | ||
self.official = Official.objects.create( | ||
name="Harold Rogers", | ||
office=office) | ||
|
||
def test_get_url_facebook(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="Facebook", | ||
channel_id="CongressmanHalRogers", | ||
) | ||
self.assertEqual(channel.get_url(), | ||
"https://www.facebook.com/CongressmanHalRogers") | ||
|
||
def test_get_url_twitter(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="Twitter", | ||
channel_id="RepHalRogers", | ||
) | ||
self.assertEqual(channel.get_url(), | ||
"https://twitter.com/RepHalRogers") | ||
|
||
def test_get_url_youtube(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="YouTube", | ||
channel_id="RepHalRogers", | ||
) | ||
self.assertEqual(channel.get_url(), | ||
"https://www.youtube.com/user/RepHalRogers") | ||
|
||
|
||
def test_get_url_google_plus(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="GooglePlus", | ||
channel_id="RepHalRogers", | ||
) | ||
self.assertEqual(channel.get_url(), | ||
"https://plus.google.com/u/0/+RepHalRogers") | ||
|
||
def test_get_service_name_facebook(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="Facebook", | ||
channel_id="CongressmanHalRogers", | ||
) | ||
self.assertEqual(channel.get_service_name(), | ||
"Facebook") | ||
|
||
def test_get_service_name_twitter(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="Twitter", | ||
channel_id="RepHalRogers", | ||
) | ||
self.assertEqual(channel.get_service_name(), | ||
"Twitter") | ||
|
||
def test_get_service_name_youtube(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="YouTube", | ||
channel_id="RepHalRogers", | ||
) | ||
self.assertEqual(channel.get_service_name(), | ||
"YouTube") | ||
|
||
def test_get_service_name_google_plus(self): | ||
channel = SocialMediaChannel( | ||
official=self.official, | ||
channel_type="GooglePlus", | ||
channel_id="RepHalRogers", | ||
) | ||
self.assertEqual(channel.get_service_name(), | ||
"Google+") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters