示例#1
0
 def test_factory_uses_correct_default_transport(self):
     pushalot = PushalotFactory.create(
         token='some-token',
     )
     self.assertEqual(pushalot._transport.__class__.__name__, 'HTTPTransport')
示例#2
0
 def test_invalid_transport_raises(self):
     with self.assertRaises(RuntimeError):
         pushalot = PushalotFactory.create(
             token='some-token',
             transport=DummyTransport
         )
示例#3
0
 def test_valid_transport_success(self):
     pushalot = PushalotFactory.create(
         token='some-token',
         transport=HTTPTransport
     )
示例#4
0
 def test_factory_initiates_correct_default_api(self):
     pushalot = PushalotFactory.create(
         token='some-token',
     )
     self.assertEqual(pushalot.__class__.__name__, 'APILatest')
示例#5
0
 def test_valid_api_used_success(self):
     pushalot = PushalotFactory.create(
         token='some-token',
         api=APILatest
     )
示例#6
0
 def test_invalid_api_raises_exception(self):
     with self.assertRaises(RuntimeError):
         pushalot = PushalotFactory.create(
             token='some-token',
             api=DummyAPI
         )
示例#7
0
 def test_with_token_success(self):
     pushalot = PushalotFactory.create(token='some-token')
示例#8
0
 def test_without_token_raises_exception(self):
     with self.assertRaises(TypeError):
         pushalot = PushalotFactory.create()