Esempio n. 1
0
 def process_request(self, api_handler, test_mode = False):
     '''
     Processes the client's request and returns the resulting
     json message to send back to the client.
     
     @return: The response to send back to the client.
     '''
     service = ServiceFactory.create_service(self.client_json, api_handler)
     return service.process_service(test_mode)
Esempio n. 2
0
 def testRaisesTypeErrorOnInvalidType(self):
     data = {
         'type': 'awgwaegfaewf',
         'data': {
             'user': {
                 'username': '******',
                 'password': '******',
                 'email': '*****@*****.**',
                 'steamid': 1
             },
             'steamid': 2,
             'game': {
                 'steamid': 3,
                 'onsaleselected': True,
                 'targetprice': 5.0,
                 'targetpriceselected': True
             }
         }
     }
     with self.assertRaises(TypeError):
         ServiceFactory.create_service(data, None)
Esempio n. 3
0
 def testMakesWatchlistGameFetcher(self):
     data = {
         'type': 'fetch_watchlist',
         'data': {
             'user': {
                 'username': '******',
                 'password': '******',
                 'email': '*****@*****.**',
                 'steamid': 1
             },
             'steamid': 2,
             'game': {
                 'steamid': 3,
                 'onsaleselected': True,
                 'targetprice': 5.0,
                 'targetpriceselected': True
             }
         }
     }
     service = ServiceFactory.create_service(data, None)
     self.assertTrue(isinstance(service, WatchlistGameFetcher))
Esempio n. 4
0
 def testMakesUserLogin(self):
     data = {
         'type': 'authenticate',
         'data': {
             'user': {
                 'username': '******',
                 'password': '******',
                 'email': '*****@*****.**',
                 'steamid': 1
             },
             'steamid': 2,
             'game': {
                 'steamid': 3,
                 'onsaleselected': True,
                 'targetprice': 5.0,
                 'targetpriceselected': True
             }
         }
     }
     service = ServiceFactory.create_service(data, None)
     self.assertTrue(isinstance(service, UserLogin))
Esempio n. 5
0
 def testMakesSteamWishlistLink(self):
     data = {
         'type': 'link_steam',
         'data': {
             'user': {
                 'username': '******',
                 'password': '******',
                 'email': '*****@*****.**',
                 'steamid': 1
             },
             'steamid': 2,
             'game': {
                 'steamid': 3,
                 'onsaleselected': True,
                 'targetprice': 5.0,
                 'targetpriceselected': True
             }
         }
     }
     service = ServiceFactory.create_service(data, None)
     self.assertTrue(isinstance(service, SteamWishlistLink))