Ejemplo n.º 1
0
    def test_items_non_whitelisted(self):
        h = push.Headers()

        def set_bad_header(h=h):
            h['X-Banana'] = 'my_channel_type'

        self.assertRaises(ValueError, set_bad_header)
Ejemplo n.º 2
0
 def test_write(self):
     h = push.Headers()
     h[push.SUBSCRIBE] = 'my_channel_type'
     headers = {}
     h.write(headers)
     self.assertEqual({'x-goog-subscribe': 'my_channel_type'}, headers)
Ejemplo n.º 3
0
 def test_read_non_whitelisted(self):
     h = push.Headers()
     h.read({'X-Banana': 'my_channel_type'})
     self.assertEqual([], list(h.items()))
Ejemplo n.º 4
0
 def test_read(self):
     h = push.Headers()
     h.read({'x-goog-subscribe': 'my_channel_type'})
     self.assertEqual([(push.SUBSCRIBE, 'my_channel_type')],
                      list(h.items()))
Ejemplo n.º 5
0
 def test_items(self):
     h = push.Headers()
     h[push.SUBSCRIBE] = 'my_channel_type'
     self.assertEqual([(push.SUBSCRIBE, 'my_channel_type')],
                      list(h.items()))
Ejemplo n.º 6
0
 def test_creation(self):
     h = push.Headers()
     self.assertEqual('', h[push.SUBSCRIBE])