Ejemplo n.º 1
0
	def testParams(self):
		self.assertEqual(Parser.parse_800_params("SEC_CODES|DEVICE=android| \
						MODEL=sdk|APP_VERSION=1.6.3|RELEASE_MODE=production| \
						OS_VERSION=4-1.6|APP_ID=?"),{'DEVICE':'android', \
						'MODEL':'sdk', 'APP_VERSION':'1.6.3', 'RELEASE_MODE' \
						:'production','OS_VERSION':'4-1.6','APP_ID':'?'})
		self.assertEqual(Parser.parse_800_params(""),{})
Ejemplo n.º 2
0
        def create_802_response(self, params, echo_params):
            params = Parser.parse_800_params(params)
            if len(params) == 0: return ["", "640 <Invalid Request>"]

            echo_params = Parser.parse_echo_params(echo_params)
            if not echo_params.has_key('ROUTER'):
                return ["", "640 <No Router>"]
        
            app_id = ""    
            if params.has_key('APP_ID'):

                app_id = params['APP_ID']
                if app_id == '?' or not devices.has_key(app_id):
                    app_id = RequestUtils.generateAppId()
                    self.addDeviceData(app_id, params, echo_params)

                response = "802 <APP_ID=" + app_id + ">"
            else :
                response = "640 <No app_id in the request>"

	    response = response.replace("####", "##");
            return [app_id, response]