def test_double_poll_subscribe(self):
        """Test double polling before subscribing."""
        cage = self.info['cage']
        policy = cage.service_object('policy')
        neutron = cage.service_object('neutron')
        datalog2 = self.info['datalog2']

        # poll twice and then subscribe: should see 2nd result
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 1)
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 2)
        policy.subscribe('neutron', 'networks', callback=policy.receive_data)
        helper.retry_check_db_equal(policy, 'p(x)', datalog2)
    def test_double_poll_subscribe(self):
        """Test double polling before subscribing."""
        cage = self.info['cage']
        policy = cage.service_object('policy')
        neutron = cage.service_object('neutron')
        datalog2 = self.info['datalog2']

        # poll twice and then subscribe: should see 2nd result
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 1)
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 2)
        policy.subscribe('neutron', 'networks', callback=policy.receive_data)
        helper.retry_check_db_equal(policy, 'p(x)', datalog2)
    def test_double_poll_subscribe(self):
        """Test double polling before subscribing."""
        cage = self.info["cage"]
        policy = cage.service_object("policy")
        neutron = cage.service_object("neutron")
        datalog2 = self.info["datalog2"]

        # poll twice and then subscribe: should see 2nd result
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 1)
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 2)
        policy.subscribe("neutron", "networks", callback=policy.receive_data)
        helper.retry_check_db_equal(policy, "p(x)", datalog2)
    def test_poll_subscribe(self):
        """Test polling before subscribing."""
        cage = self.info['cage']
        policy = cage.service_object('policy')
        neutron = cage.service_object('neutron')
        datalog1 = self.info['datalog1']
        datalog2 = self.info['datalog2']
        fake_networks = self.info['fake_networks']

        # add garbage to policy
        for formula in fake_networks:
            policy.insert(formula)

        # poll 1 and then subscribe; should still see first result
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 1)
        policy.subscribe('neutron', 'networks', callback=policy.receive_data)
        helper.retry_check_db_equal(policy, 'p(x)', datalog1)

        # poll 2
        neutron.poll()
        helper.retry_check_db_equal(policy, 'p(x)', datalog2)
    def test_poll_subscribe(self):
        """Test polling before subscribing."""
        cage = self.info['cage']
        policy = cage.service_object('policy')
        neutron = cage.service_object('neutron')
        datalog1 = self.info['datalog1']
        datalog2 = self.info['datalog2']
        fake_networks = self.info['fake_networks']

        # add garbage to policy
        for formula in fake_networks:
            policy.insert(formula)

        # poll 1 and then subscribe; should still see first result
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 1)
        policy.subscribe('neutron', 'networks', callback=policy.receive_data)
        helper.retry_check_db_equal(policy, 'p(x)', datalog1)

        # poll 2
        neutron.poll()
        helper.retry_check_db_equal(policy, 'p(x)', datalog2)
    def test_poll_subscribe(self):
        """Test polling before subscribing."""
        cage = self.info["cage"]
        policy = cage.service_object("policy")
        neutron = cage.service_object("neutron")
        datalog1 = self.info["datalog1"]
        datalog2 = self.info["datalog2"]
        fake_networks = self.info["fake_networks"]

        # add garbage to policy
        for formula in fake_networks:
            policy.insert(formula)

        # poll 1 and then subscribe; should still see first result
        neutron.poll()
        helper.retry_check_number_of_updates(neutron, 1)
        policy.subscribe("neutron", "networks", callback=policy.receive_data)
        helper.retry_check_db_equal(policy, "p(x)", datalog1)

        # poll 2
        neutron.poll()
        helper.retry_check_db_equal(policy, "p(x)", datalog2)