def test_raises_not_logged_in_exception(self):
     api = ApiWrapper(get_fake_conf())
     api.set_position(*(42, 42, 0))
     request = api.create_request()
     request.get_inventory(test='awesome')
     with self.assertRaises(NotLoggedInException):
         request.call()
Esempio n. 2
0
 def test_raises_not_logged_in_exception(self):
     api = ApiWrapper()
     api.set_position(*(42, 42, 0))
     request = api.create_request()
     request.get_inventory(test='awesome')
     with self.assertRaises(NotLoggedInException):
         request.call()
 def test_raises_no_player_position_set_exception(self):
     request = ApiWrapper(get_fake_conf()).create_request()
     request.get_inventory(test='awesome')
     with self.assertRaises(NoPlayerPositionSetException):
         request.call()
 def test_api_wrong_request(self):
     request = ApiWrapper(get_fake_conf()).create_request()
     with self.assertRaises(AttributeError):
         request.wrong_request()
Esempio n. 5
0
 def create_request(self, return_value='mock return'):
     request = ApiWrapper.create_request(self)
     request.can_call = MagicMock(return_value=True)
     request._call = MagicMock(return_value=return_value)
     return request
Esempio n. 6
0
 def create_request(self, return_value='mock return'):
     request = ApiWrapper.create_request(self)
     request.can_call = MagicMock(return_value=True)
     request._call = MagicMock(return_value=return_value)
     return request
Esempio n. 7
0
 def test_raises_no_player_position_set_exception(self):
     request = ApiWrapper().create_request()
     request.get_inventory(test='awesome')
     with self.assertRaises(NoPlayerPositionSetException):
         request.call()
Esempio n. 8
0
 def test_api_wrong_request(self):
     request = ApiWrapper().create_request()
     with self.assertRaises(AttributeError):
         request.wrong_request()
Esempio n. 9
0
 def test_api_call_with_no_requests_set(self):
     request = ApiWrapper().create_request()
     with self.assertRaises(EmptySubrequestChainException):
         request.call()
Esempio n. 10
0
 def test_api_call_with_no_requests_set(self):
     api = ApiWrapper(PGoApi())
     with self.assertRaises(RuntimeError):
         api.call()
Esempio n. 11
0
 def test_raises_not_logged_in_exception(self):
     api = ApiWrapper(PGoApi())
     api.get_inventory(test='awesome')
     with self.assertRaises(NotLoggedInException):
         api.call()
Esempio n. 12
0
 def test_api_call_with_no_requests_set(self):
     request = ApiWrapper().create_request()
     with self.assertRaises(EmptySubrequestChainException):
         request.call()