コード例 #1
0
ファイル: api.py プロジェクト: anukat2015/opal-1
 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)
コード例 #2
0
ファイル: api.py プロジェクト: 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)
コード例 #3
0
ファイル: test_core_glossolalia.py プロジェクト: wjt/opal
 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'])
コード例 #4
0
ファイル: test_core_glossolalia.py プロジェクト: wjt/opal
 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)
コード例 #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'])
コード例 #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)