Skip to content
Browse files

Fixed has_audio test

  • Loading branch information...
1 parent b36ab2d commit 6191465281d5e144bc106d4042023edd10cb989b Sam Karp committed Apr 6, 2011
Showing with 10 additions and 9 deletions.
  1. +3 −3 example/settings.py
  2. +1 −1 geocamTalk/models.py
  3. +6 −5 geocamTalk/tests/unit.py
View
6 example/settings.py
@@ -45,17 +45,17 @@
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
-#MEDIA_ROOT = os.path.abspath(os.path.join('media'))
+MEDIA_ROOT = os.path.abspath(os.path.join('media'))
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
-#MEDIA_URL = '/static/'
+MEDIA_URL = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-#ADMIN_MEDIA_PREFIX = '/media/'
+ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'g2_39yupn*6j4p*cg2%w643jiq-1n_annua*%i8+rq0dx9p=$n'
View
2 geocamTalk/models.py
@@ -37,7 +37,7 @@ class TalkMessage(GeocamMessage):
"""
#TODO - add time to filename location
- audio_file = models.FileField(null=True, blank=True, upload_to='audio') #"%s-audio" % (GeocamMessage.author))
+ audio_file = models.FileField(null=True, blank=True, upload_to='geocamTalk/audio') #"%s-audio" % (GeocamMessage.author))
def __unicode__(self):
try:
View
11 geocamTalk/tests/unit.py
@@ -41,21 +41,22 @@ def testCanStoreAudioMessage(self):
sender = User.objects.all()[0]
#act
- message1 = TalkMessage.objects.create(
+ no_audio_message = TalkMessage.objects.create(
content="012345678901234567890123456789",
- content_timestamp=self.now,
+ content_timestamp=self.now,
+ audio_file='',
author=sender)
- message2 = TalkMessage.objects.create(
+ audio_message = TalkMessage.objects.create(
audio_file="audiofile.mp4",
content_timestamp=self.now,
author=sender)
#assert
- self.assertFalse(message1.has_audio())
- self.assertTrue(message2.has_audio())
+ self.assertFalse(no_audio_message.has_audio())
+ self.assertTrue(audio_message.has_audio())
class TalkUserProfileUnitTest(TestCase):

0 comments on commit 6191465

Please sign in to comment.
Something went wrong with that request. Please try again.