@mock.patch.object(FakeCloud, 'list_server_security_groups')
    def test_get_security_groups(self,
                                 mock_list_server_security_groups):
        mock_list_server_security_groups.return_value = [
            {'name': 'testgroup', 'id': '1'}]

        server = meta.obj_to_dict(standard_fake_server)
        hostvars = meta.get_hostvars_from_server(FakeCloud(), server)

        mock_list_server_security_groups.assert_called_once_with(server)
        self.assertEqual('testgroup',
                         hostvars['security_groups'][0]['name'])
This test verifies that calling get_hostvars_froms_server
dataset/ETHPy150Open openstack-infra/shade/shade/tests/unit/test_meta.py/TestMeta.test_get_security_groups