def test_integration_delete_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)

        channels = get_channels_from_microsoft(log, test_connection, TEAM_ID, TEST_CHANNEL_NAME, True)
        channel_id = channels[0].get("id")

        result = delete_channel(log, test_connection, TEAM_ID, channel_id)

        # Leaving this code here - This can be used for bulk delete if needed

        # for i in range(100):
        #     channel_name = f"{i}_test_channel_3"
        #     channels = get_channels_from_microsoft(log, test_connection, TEAM_ID, channel_name)
        #     channel_id = channels[0].get("id")
        #     delete_channel(log, test_connection, TEAM_ID, channel_id)
        #     time.sleep(1)

        self.assertTrue(result)
Ejemplo n.º 2
0
    def run(self, params={}):
        team_name = params.get(Input.TEAM_NAME)
        channel_name = params.get(Input.CHANNEL_NAME)

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

        success = delete_channel(self.logger, self.connection, team_id, channel_id)

        return {Output.SUCCESS: success}
Ejemplo n.º 3
0
    def test_delete_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)

        channels = get_channels_from_microsoft(log, test_connection, TEAM_ID,
                                               TEST_CHANNEL_NAME)
        channel_id = channels[0].get("id")

        result = delete_channel(log, test_connection, TEAM_ID, channel_id)
        self.assertTrue(result)