'Verify that the command requests and caches program UUIDs and details.'

@waffle.testutils.override_switch('populate-multitenant-programs', True)
def test_handle(self):

    UserFactory(username=self.catalog_integration.service_username)
    programs = {PROGRAM_CACHE_KEY_TPL.format(uuid=program['uuid']): program for program in self.programs}
    self.mock_list()
    for uuid in self.uuids:
        program = programs[PROGRAM_CACHE_KEY_TPL.format(uuid=uuid)]
        self.mock_detail(uuid, program)
    call_command('cache_programs')
    cached_uuids = cache.get(SITE_PROGRAM_UUIDS_CACHE_KEY_TPL.format(domain=self.site_domain))
    self.assertEqual(set(cached_uuids), set(self.uuids))
    program_keys = list(programs.keys())
    cached_programs = cache.get_many(program_keys)
    self.assertEqual(set(cached_programs), set(programs))
    for (key, program) in cached_programs.items():
        self.assertEqual(program, programs[key])
