Пример #1
0
    def bind(self, anonymous_id, customer_id, oauth_token=None, callback=None):
        customer = Customer()
        customer.customer = customer_id

        return self.run(
            commands.Bind(self,
                          args=(anonymous_id, customer),
                          oauth_token=oauth_token), callback)
Пример #2
0
        def on_anon(anonymous):
            self.assertIsNotNone(anonymous)

            customer = Customer()
            customer.customer = 'py-unittest-customer-%s' % datetime.now()

            future = self.client.bind(anonymous, customer.customer, oauth_token=self.oauth_token,
                                      callback=self.on_async_callback)
            self.wait_running_future(future)
Пример #3
0
        def on_anon(anonymous):
            self.assertIsNotNone(anonymous)

            customer = Customer()
            customer.customer = 'py-unittest-customer-%s' % datetime.now()

            future = self.client.bind(anonymous,
                                      customer.customer,
                                      oauth_token=self.oauth_token,
                                      callback=self.on_async_callback)
            self.wait_running_future(future)
Пример #4
0
    def test_bind(self):
        """
        Test a binding call request
        """

        anonymous = self.client.create_anonymous(oauth_token=self.oauth_token)
        self.assertIsNotNone(anonymous)

        customer = Customer()
        customer.customer = 'py-unittest-customer-%s' % datetime.now()

        self.assertIsNotNone(self.client.bind(anonymous, customer.customer, oauth_token=self.oauth_token))
Пример #5
0
    def test_bound_to_correct_customer(self):
        """
        Verify that the bind happened correctly between anonymousId and customer
        """

        customer = Customer()
        customer.customer = 'pytest-customer'
        self.client.bind('12345', customer.customer, oauth_token=self.oauth_token)

        result_customer = self.client.get_bound_customer('12345', oauth_token=self.oauth_token)
        self.assertIsNotNone(result_customer)

        self.assertEqual(customer.customer, result_customer.customer)
Пример #6
0
    def test_bind(self):
        """
        Test a binding call request
        """

        anonymous = self.client.create_anonymous(oauth_token=self.oauth_token)
        self.assertIsNotNone(anonymous)

        customer = Customer()
        customer.customer = 'py-unittest-customer-%s' % datetime.now()

        self.assertIsNotNone(
            self.client.bind(anonymous,
                             customer.customer,
                             oauth_token=self.oauth_token))
Пример #7
0
    def test_bound_to_correct_customer(self):
        """
        Verify that the bind happened correctly between anonymousId and customer
        """

        customer = Customer()
        customer.customer = 'pytest-customer'
        self.client.bind('12345',
                         customer.customer,
                         oauth_token=self.oauth_token)

        result_customer = self.client.get_bound_customer(
            '12345', oauth_token=self.oauth_token)
        self.assertIsNotNone(result_customer)

        self.assertEqual(customer.customer, result_customer.customer)
Пример #8
0
    def test_bound_to_correct_customer_async(self):
        """
        Verify that the bind happened correctly between anonymousId and customer (async)
        """

        def on_bind(result):
            def on_get(result_customer):
                self.assertIsNotNone(result_customer)

                self.assertEqual(customer.customer, result_customer.customer)

            future = self.client.get_bound_customer('12345', oauth_token=self.oauth_token, callback=on_get)
            self.wait_running_future(future)

        customer = Customer()
        customer.customer = 'pytest-customer'

        future = self.client.bind('12345', customer.customer, oauth_token=self.oauth_token, callback=on_bind)
        self.wait_running_future(future)
Пример #9
0
    def test_bound_to_correct_customer_async(self):
        """
        Verify that the bind happened correctly between anonymousId and customer (async)
        """
        def on_bind(result):
            def on_get(result_customer):
                self.assertIsNotNone(result_customer)

                self.assertEqual(customer.customer, result_customer.customer)

            future = self.client.get_bound_customer(
                '12345', oauth_token=self.oauth_token, callback=on_get)
            self.wait_running_future(future)

        customer = Customer()
        customer.customer = 'pytest-customer'

        future = self.client.bind('12345',
                                  customer.customer,
                                  oauth_token=self.oauth_token,
                                  callback=on_bind)
        self.wait_running_future(future)
Пример #10
0
    def bind(self, anonymous_id, customer_id, oauth_token=None, callback=None):
        customer = Customer()
        customer.customer = customer_id

        return self.run(commands.Bind(self, args=(anonymous_id, customer), oauth_token=oauth_token), callback)