def test_explain(self):
        """ Verifies explain runs if there is a success [aka _explain is implemented]."""
        country = Group()
        country.name = self.strategy._COUNTRY
        self.DB.insert_one(db_constants.GROUPS, country)

        self.group_result.outcome = outcomes.AGN
        self.credo_result.outcome = outcomes.AGN

        self.decision.groups_for = [self.stance]
        self.decision.groups_agn = [self.stance_country]

        result = self.strategy.run()

        self.assertTrue(result)
        self.strategy.explain()
    def test_run_fail_country_split_AGN(self):
        """ Verifies an AGN consensus fails if the country is split."""
        country = Group()
        country.name = self.strategy._COUNTRY
        self.DB.insert_one(db_constants.GROUPS, country)

        self.group_result.outcome = outcomes.AGN
        self.credo_result.outcome = outcomes.AGN

        self.decision.groups_for = [self.stance_country]
        self.decision.groups_agn = [self.stance_country]

        result = self.strategy.run()

        self.assertFalse(result)
        self.assertFalse(self.strategy._success)
        self.assertEquals(self.decision.result, None)
        self.assertEquals(self.decision.reason, None)
    def test_run_fail_no_country_stance_in_groups_agn(self):
        """ Verifies the function fails if the country has no AGN stances."""
        country = Group()
        country.name = self.strategy._COUNTRY
        self.DB.insert_one(db_constants.GROUPS, country)

        self.group_result.outcome = outcomes.AGN
        self.credo_result.outcome = outcomes.AGN

        self.decision.groups_for = [self.stance]
        self.decision.groups_agn = [self.stance1]

        result = self.strategy.run()

        self.assertFalse(result)
        self.assertFalse(self.strategy._success)
        self.assertEquals(self.decision.result, None)
        self.assertEquals(self.decision.reason, None)
    def test_run_success_AGN(self):
        """ Verifies that run() successfully makes a AGN decision"""
        country = Group()
        country.name = self.strategy._COUNTRY
        self.DB.insert_one(db_constants.GROUPS, country)

        self.group_result.outcome = outcomes.AGN
        self.credo_result.outcome = outcomes.AGN

        self.decision.groups_for = [self.stance]
        self.decision.groups_agn = [self.stance_country, self.stance1]

        result = self.strategy.run()

        self.assertTrue(result)
        self.assertTrue(self.strategy._success)
        self.assertEquals(self.strategy._country_stances, [self.stance_country])
        self.assertEquals(self.decision.result, outcomes.AGN)
        self.assertEquals(self.decision.reason, self.decision.agn_stances)
        self.assertEquals(self.decision.downside, self.decision.for_stances)