Ejemplo n.º 1
0
 def update(self, request, episode):
     if 'id' in request.data:
         del request.data['id']
     tag_names = [n for n, v in request.data.items() if v]
     pre = episode.to_dict(request.user)
     episode.set_tag_names(tag_names, request.user)
     post = episode.to_dict(request.user)
     glossolalia.transfer(pre, post)
     return Response(episode.tagging_dict(request.user)[0], status=status.HTTP_202_ACCEPTED)
Ejemplo n.º 2
0
Archivo: api.py Proyecto: wjt/opal
 def update(self, request, episode):
     if 'id' in request.data:
         del request.data['id']
     tag_names = [n for n, v in request.data.items() if v]
     pre = episode.to_dict(request.user)
     episode.set_tag_names(tag_names, request.user)
     post = episode.to_dict(request.user)
     glossolalia.transfer(pre, post)
     return Response(episode.tagging_dict(request.user)[0],
                     status=status.HTTP_202_ACCEPTED)
Ejemplo n.º 3
0
 def test_transfer_calls_send_upstream(self, sender):
     with patch('opal.core.glossolalia.INTEGRATING', new=True):
         transfer = glossolalia.transfer({}, {'foo': 'bar'})
         self.assertEqual('transfer', sender.call_args[0][0])
         self.assertEqual(
             'bar',
             json.loads(sender.call_args[0][1]['data'])['post']['foo'])
Ejemplo n.º 4
0
 def test_transfer_not_integratng(self, sender):
     with patch('opal.core.glossolalia.INTEGRATING', new=False):
         transfer = glossolalia.transfer(None, None)
         self.assertEqual(
             None, transfer)  # Mostly a proxy for "Does this stacktrace?"
         self.assertFalse(sender.called)
Ejemplo n.º 5
0
 def test_transfer_calls_send_upstream(self, sender):
     with patch('opal.core.glossolalia.INTEGRATING', new=True):
         transfer = glossolalia.transfer({}, {'foo': 'bar'})
         self.assertEqual('transfer', sender.call_args[0][0])
         self.assertEqual('bar', json.loads(sender.call_args[0][1]['data'])['post']['foo'])
Ejemplo n.º 6
0
 def test_transfer_not_integratng(self, sender):
     with patch('opal.core.glossolalia.INTEGRATING', new=False):
         transfer = glossolalia.transfer(None, None)
         self.assertEqual(None, transfer) # Mostly a proxy for "Does this stacktrace?"
         self.assertFalse(sender.called)