'Check that the groups appear and are correctly categorized as to active and inactive.
Also checks that the "add missing groups" button/link is not present unless a value of False is passed
for verify_missing_groups_not_present.'

def verify_groups(self, container, active_groups, inactive_groups, verify_missing_groups_not_present=True):

    def wait_for_xblocks_to_render():
        return (((len(active_groups) + len(inactive_groups)) == (len(container.xblocks) - 1)), len(active_groups))
    Promise(wait_for_xblocks_to_render, 'Number    of    xblocks    on    the    page    are    incorrect').fulfill()
    def check_xblock_names(expected_groups, actual_blocks):
        self.assertEqual(len(expected_groups), len(actual_blocks))
        for (idx, expected) in enumerate(expected_groups):
            self.assertEqual(expected, actual_blocks[idx].name)
    check_xblock_names(active_groups, container.active_xblocks)
    check_xblock_names(inactive_groups, container.inactive_xblocks)
    check_xblock_names((active_groups + inactive_groups), container.xblocks[1:])
    if verify_missing_groups_not_present:
        self.verify_add_missing_groups_button_not_present(container)
