def test_request_stream_listener_in_range(self):
     """ Make sure we get good stream data if listener is in range.
     Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1', 'latitude': '0.1', 'longitude': '0.1'}
     expected = {'stream_url': 'http://rw.com:8000/stream1.ogg'}
     self.assertEquals(expected, request_stream(req))
 def test_request_stream_listener_in_range_no_lat_long_passed(self):
     """ Make sure we get good stream data if no lat/long passed
     Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1'}
     expected = {'stream_url': 'http://rw.com:8000/stream1.ogg'}
     self.assertEquals(expected, request_stream(req))
Example #3
0
 def test_request_stream_listener_in_range_no_lat_long_passed(self):
     """ Make sure we get good stream data if no lat/long passed
     Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1'}
     expected = {'stream_url': 'http://rw.com:8000/stream1.ogg'}
     self.assertEquals(expected, request_stream(req))
Example #4
0
 def test_request_stream_listener_in_range(self):
     """ Make sure we get good stream data if listener is in range.
     Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1', 'latitude': '0.1', 'longitude': '0.1'}
     expected = {'stream_url': 'http://rw.com:8000/stream1.ogg'}
     self.assertEquals(expected, request_stream(req))
 def test_request_stream_just_one_speaker_in_range_needed(self):
     speaker2 = mommy.make(Speaker, project=self.project1,
                           latitude=0.1, longitude=0.1,
                           maxdistance=2000000000000, activeyn=True)
     speaker2.save()
     req = FakeRequest()
     req.GET = {'session_id': '1'}
     expected = {'stream_url': 'http://rw.com:8000/stream1.ogg'}
     self.assertEquals(expected, request_stream(req))
Example #6
0
 def test_request_stream_just_one_speaker_in_range_needed(self):
     speaker2 = mommy.make(Speaker,
                           project=self.project1,
                           latitude=0.1,
                           longitude=0.1,
                           maxdistance=2000000000000,
                           activeyn=True)
     speaker2.save()
     req = FakeRequest()
     req.GET = {'session_id': '1'}
     expected = {'stream_url': 'http://rw.com:8000/stream1.ogg'}
     self.assertEquals(expected, request_stream(req))
 def test_request_stream_demo_stream_enabled(self):
     """ Make sure we get the demo stream data if it's enabled for the 
     session, and the localized message in the correct language for the 
     session. Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1'}
     self.session.demo_stream_enabled = True
     self.session.save()
     expected = {
         'stream_url': 'http://rw.com:8000/demo_stream.mp3',
         'demo_stream_message': 'Uno'
     }
     self.assertEquals(expected, request_stream(req))
     self.session.demo_stream_enabled = False
     self.session.save()
Example #8
0
 def test_request_stream_demo_stream_enabled(self):
     """ Make sure we get the demo stream data if it's enabled for the 
     session, and the localized message in the correct language for the 
     session. Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1'}
     self.session.demo_stream_enabled = True
     self.session.save()
     expected = {
         'stream_url': 'http://rw.com:8000/demo_stream.mp3',
         'demo_stream_message': 'Uno'
     }
     self.assertEquals(expected, request_stream(req))
     self.session.demo_stream_enabled = False
     self.session.save()
 def test_request_stream_listener_out_of_range(self):
     """ Make sure we get out of range message if listener is too far.
     Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1', 'latitude': '0.1', 'longitude': '0.1'}
     expected = {
         'user_message': ('This application is designed to be used in '
                          'specific geographic locations. Apparently '
                          'your phone thinks you are not at one of those '
                          'locations, so you will hear a sample audio '
                          'stream instead of the real deal. If you think '
                          'your phone is incorrect, please restart Scapes '
                          'and it will probably work. Thanks for '
                          'checking it out!'),
         'stream_url': 'http://rw.com:8000/outofrange.mp3'}
     self.assertEquals(expected, request_stream(req))
Example #10
0
 def test_request_stream_listener_out_of_range(self):
     """ Make sure we get out of range message if listener is too far.
     Doesn't test actual stream being served.
     """
     req = FakeRequest()
     req.GET = {'session_id': '1', 'latitude': '0.1', 'longitude': '0.1'}
     expected = {
         'user_message': ('This application is designed to be used in '
                          'specific geographic locations. Apparently '
                          'your phone thinks you are not at one of those '
                          'locations, so you will hear a sample audio '
                          'stream instead of the real deal. If you think '
                          'your phone is incorrect, please restart Scapes '
                          'and it will probably work. Thanks for '
                          'checking it out!'),
         'stream_url':
         'http://rw.com:8000/outofrange.mp3'
     }
     self.assertEquals(expected, request_stream(req))
 def test_request_stream_inactive_speakers_not_involved(self):
     """ Inactive speakers don't count for in-range
     """
     req = FakeRequest()
     req.GET = {'session_id': '1', 'latitude': '0.1', 'longitude': '0.1'}
     self.speaker1.activeyn = False
     self.speaker1.save()
     expected = {
         'user_message': ('This application is designed to be used in '
                          'specific geographic locations. Apparently '
                          'your phone thinks you are not at one of those '
                          'locations, so you will hear a sample audio '
                          'stream instead of the real deal. If you think '
                          'your phone is incorrect, please restart Scapes '
                          'and it will probably work. Thanks for '
                          'checking it out!'),
         'stream_url': 'http://rw.com:8000/outofrange.mp3'}
     self.assertEquals(expected, request_stream(req))
     self.speaker1.activeyn = True
     self.speaker1.save()
Example #12
0
 def test_request_stream_inactive_speakers_not_involved(self):
     """ Inactive speakers don't count for in-range
     """
     req = FakeRequest()
     req.GET = {'session_id': '1', 'latitude': '0.1', 'longitude': '0.1'}
     self.speaker1.activeyn = False
     self.speaker1.save()
     expected = {
         'user_message': ('This application is designed to be used in '
                          'specific geographic locations. Apparently '
                          'your phone thinks you are not at one of those '
                          'locations, so you will hear a sample audio '
                          'stream instead of the real deal. If you think '
                          'your phone is incorrect, please restart Scapes '
                          'and it will probably work. Thanks for '
                          'checking it out!'),
         'stream_url':
         'http://rw.com:8000/outofrange.mp3'
     }
     self.assertEquals(expected, request_stream(req))
     self.speaker1.activeyn = True
     self.speaker1.save()