new_contents: """Test login to an ICAT server.
  """
  
  from __future__ import print_function
  import pytest
  import icat
  import icat.config
  
  # Try out three different users: root, useroffice, and acord.  Normal
  # users like acord might use a different authentication plugin then
  # system users as root and useroffice.  We want to try out both cases.
  @pytest.mark.parametrize("user", ["root", "useroffice", "acord"])
  def test_login(icatconfigfile, user):
      """Login to the ICAT server.
      """
  
      args = ["-c", icatconfigfile, "-s", user]
      conf = icat.config.Config().getconfig(args)
      client = icat.Client(conf.url, **conf.client_kwargs)
      sessionId = client.login(conf.auth, conf.credentials)
      assert sessionId
      assert sessionId == client.sessionId
      username = client.getUserName()
      assert username == user
      print("\nLogged in as %s to %s." % (user, conf.url))
      client.logout()
      assert client.sessionId is None
  
      # Verify that the logout was effective, e.g. that the sessionId is
      # invalidated.
      client.sessionId = sessionId
      with pytest.raises(icat.exception.ICATSessionError):
          username = client.getUserName()
  
      # Avoid a spurious SessionError at exit in the implicit logout()
      client.sessionId = None
  
subject: Add test to login to the ICAT server.