def test_enable_teams_for_group(self):
        log = logging.getLogger()
        connection = Connection()
        connection.logger = log

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

        connection.connect(connection_params)

        # try nuking the group first, create_group fails if it's already there
        try:
            delete_group(logging, connection, "test_group_delete_me")
            sleep(10)  # give Azure time to do it's thing
        except Exception:
            pass

        result = create_group(log, connection, "test_group_delete_me",
                              "A test group to delete", "nickname_goes_here",
                              True, None, None)

        self.assertIsNotNone(result)
        self.assertEqual(result.get('displayName'), 'test_group_delete_me')
        self.assertEqual(result.get('description'), 'A test group to delete')

        group_id = result.get('id')
        success = enable_teams_for_group(log, connection, group_id)

        self.assertTrue(success)
    def test_delete_group(self):
        log = logging.getLogger()
        connection = Connection()
        connection.logger = log

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

        connection.connect(connection_params)
        result = delete_group(log, connection, "test_group_delete_me")

        self.assertTrue(result)
Esempio n. 3
0
 def run(self, params={}):
     team_name = params.get(Input.TEAM_NAME)
     success = delete_group(self.logger, self.connection, team_name)
     return {Output.SUCCESS: success}