Beispiel #1
0
    def run(self, params={}):
        team_name = params.get(Input.TEAM_NAME)
        channel_name = params.get(Input.CHANNEL_NAME)
        channel_description = params.get(Input.CHANNEL_DESCRIPTION)

        teams = get_teams_from_microsoft(self.logger, self.connection, team_name)
        team_id = teams[0].get("id")

        success = create_channel(self.logger, self.connection, team_id, channel_name, channel_description)

        return {Output.SUCCESS: success}
Beispiel #2
0
    def test_create_channel(self):
        log = logging.getLogger("Test")
        test_connection = Connection()
        test_connection.logger = log

        with open("../tests/send_message.json") as file:
            data = json.load(file)
            connection_params = data.get("body").get("connection")

        test_connection.connect(connection_params)

        result = create_channel(log, test_connection, TEAM_ID,
                                TEST_CHANNEL_NAME,
                                "some really cool test description")
        self.assertTrue(result)
    def test_integraion_create_channel(self):
        log = logging.getLogger("Test")
        test_connection = Connection()
        test_connection.logger = log

        with open("../tests/send_message.json") as file:
            data = json.load(file)
            connection_params = data.get("body").get("connection")

        test_connection.connect(connection_params)

        result = create_channel(log, test_connection, TEAM_ID, TEST_CHANNEL_NAME, "some really cool test description")

        # This code is used to bulk create channels. Needed to max out a team with channels to test
        # pagination

        # for i in range(200):
        #     channel_name = f"{i}_test_channel"
        #     create_channel(log, test_connection, TEAM_ID, channel_name, "some really cool test description")

        self.assertTrue(result)