Exemple #1
0
    def setUp(self):
        self.slack_community, self.user = TestUtils.create_slack_community_and_user()

        self.policy = Policy.objects.create(
            **TestUtils.ALL_ACTIONS_PROPOSED,
            kind=Policy.PLATFORM,
            community=self.slack_community.community,
        )
        self.action = SlackPinMessage(initiator=self.user, community=self.slack_community, community_origin=True)
        self.action.revert = lambda: None
        self.action.execute = lambda: None
        self.action.save()
        self.proposal = Proposal.objects.create(action=self.action, policy=self.policy)
Exemple #2
0
    def setUp(self):
        # Set up a Slack community and a user
        self.slack_community, self.user = TestUtils.create_slack_community_and_user(
        )
        self.community = self.slack_community.community

        # Enable a plugin to use in tests
        self.metagov_community = metagov.get_community(
            self.community.metagov_slug)
        self.metagov_community.enable_plugin("randomness", {
            "default_low": 2,
            "default_high": 200
        })
Exemple #3
0
    def setUp(self):
        self.slack_community, self.user = TestUtils.create_slack_community_and_user(
        )
        self.community = self.slack_community.community
        self.constitution_community = self.community.constitution_community
        self.client.force_login(
            user=self.user,
            backend="integrations.slack.auth_backends.SlackBackend")

        # create a constitution policy to govern policy creation
        Policy.objects.create(**TestUtils.ALL_ACTIONS_PASS,
                              kind=Policy.CONSTITUTION,
                              community=self.community)
Exemple #4
0
    def test_action_type_util(self):
        slack_community, user = TestUtils.create_slack_community_and_user()
        community = slack_community.community

        actions = Utils.get_action_types(community,
                                         [PolicyActionKind.CONSTITUTION])
        self.assertIsNotNone(actions["constitution"])
        actions = Utils.get_action_types(community,
                                         [PolicyActionKind.PLATFORM])

        self.assertIsNotNone(actions["slack"])

        actions = Utils.get_action_types(community, [PolicyActionKind.TRIGGER])
        self.assertIsNotNone(actions["any platform"])
Exemple #5
0
 def setUp(self):
     self.slack_community, self.user = TestUtils.create_slack_community_and_user(
     )
     self.community = self.slack_community.community
     self.constitution_community = self.community.constitution_community