Example #1
0
    def test_build_params(self):
        et = EventTracker()

        event = 'foo_event'
        is_test = 1
        properties = {'token': 'testtoken'}
        params = {'event': event, 'properties': properties}

        url_params = et._build_params(event, properties, is_test)

        expected_params = urllib.urlencode({
            'data': base64.b64encode(simplejson.dumps(params)),
            'test': is_test,
        })

        self.assertEqual(expected_params, url_params)
Example #2
0
    def test_build_and_encode_params(self):
        et = EventTracker()

        event = 'foo_event'
        test = True
        properties = {'token': 'testtoken'}
        params = {'event': event, 'properties': properties}

        params = et._build_params(event, properties)
        url_params = et._encode_params(params, test)

        expected_params = urllib.parse.urlencode({
            'data': base64.b64encode(json.dumps(params).encode('utf8')),
            'test': '1'
        })

        self.assertEqual(expected_params, url_params)
Example #3
0
    def test_build_params(self):
        et = EventTracker()

        event = 'foo_event'
        is_test = 1
        properties = {'token': 'testtoken'}
        params = {'event': event, 'properties': properties}

        url_params = et._build_params(event, properties, is_test)

        expected_params = urllib.urlencode({
            'data':
            base64.b64encode(simplejson.dumps(params)),
            'test':
            is_test,
        })

        self.assertEqual(expected_params, url_params)
Example #4
0
    def test_build_and_encode_params(self):
        et = EventTracker()

        event = 'foo_event'
        test = True
        properties = {'token': 'testtoken'}
        params = {'event': event, 'properties': properties}

        params = et._build_params(event, properties)
        url_params = et._encode_params(params, test)

        expected_params = urllib.parse.urlencode({
            'data':
            base64.b64encode(json.dumps(params).encode('utf8')),
            'test':
            '1'
        })

        self.assertEqual(expected_params, url_params)