コード例 #1
0
    def test_should_get_domain_error_when_campaign_does_not_exist(self):
        # given
        self.campaign_repository_mock.read_by_id.return_value = None

        # when then
        with self.assertRaises(DomainError):
            campaign_service.check_if_campaign_gm(88, 99)
コード例 #2
0
    def test_should_get_false_when_user_is_not_campaign_gm(self):
        # given
        campaign = CampaignEntity()
        campaign.id = 99
        campaign.created_on = date(2020, 1, 1)
        campaign.modified_on = date(2020, 1, 1)
        campaign.opt_lock = 0
        campaign.campaign_name = "Test Campaign"
        campaign.begin_date = date(2055, 1, 1)
        campaign.passed_days = 10

        gm = UserEntity()
        gm.id = 77
        gm.created_on = date(2019, 1, 1)
        gm.modified_on = date(2019, 1, 1)
        gm.opt_lock = 0
        gm.user_name = "Test User"

        campaign.game_master = gm

        self.campaign_repository_mock.read_by_id.return_value = campaign

        # when
        result = campaign_service.check_if_campaign_gm(88, 99)

        # then
        self.assertFalse(result)
コード例 #3
0
 def test_should_get_value_error_when_campaign_id_is_not_int(self):
     # when then
     with self.assertRaises(ValueError):
         campaign_service.check_if_campaign_gm(88, "99")
コード例 #4
0
 def test_should_get_domain_error_when_campaign_id_is_none(self):
     # when then
     with self.assertRaises(DomainError):
         campaign_service.check_if_campaign_gm(88, None)