File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 44 division )
55
66import urlfetch
7- import json
87from pusher .http import process_response
98
109class URLFetchBackend (object ):
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+
3+ from __future__ import print_function , absolute_import , division
4+
5+ import pusher
6+ import unittest
7+ import httpretty
8+ import sys
9+
10+ @unittest .skipIf (sys .version_info >= (3 ,), "skip" )
11+ class TestURLFetchBackend (unittest .TestCase ):
12+
13+ def setUp (self ):
14+ import pusher .urlfetch
15+ self .p = pusher .Pusher .from_url (u'http://key:secret@api.pusherapp.com/apps/4' ,
16+ backend = pusher .urlfetch .URLFetchBackend )
17+
18+ @httpretty .activate
19+ def test_trigger_urlfetch_success (self ):
20+ httpretty .register_uri (httpretty .POST , "http://api.pusherapp.com/apps/4/events" ,
21+ body = "{}" ,
22+ content_type = "application/json" )
23+ response = self .p .trigger (u'test_channel' , u'test' , {u'data' : u'yolo' })
24+ self .assertEqual (response , {})
25+
26+ if __name__ == '__main__' :
27+ unittest .main ()
You can’t perform that action at this time.
0 commit comments