예제 #1
0
  def test_mpdclient_disconnect_none_doesnt_raises(self):
    """
    Test that when a connection error is raised on disconnect
    """
    mpdconf={"host":"badhost","port":6600}
    mpdclient = MpdClient(mpdconf)

    #Mock the mpd client
    mpdclient.client=None

    # Call
    mpdclient.disconnect()
예제 #2
0
  def test_mpdclient_disconnect_mpdexception_raises_mpdclientexception(self):
    mpdconf={"host":"badhost","port":6600}
    mpdclient = MpdClient(mpdconf)

    #Mock the mpd client
    mpdmock=Mock()
    mpdclient.client=mpdmock
    #Mock the connect method
    disconnect=Mock(side_effect=MPDError())
    mpdmock.disconnect=disconnect

    # Call
    with self.assertRaises(MpdClientException):
      mpdclient.disconnect()
예제 #3
0
  def test_mpdclient_disconnect_connectionexception_doesnt_raises(self):
    """
    Test that when a connection error is raised on disconnect no exception is raised
    """
    mpdconf={"host":"badhost","port":6600}
    mpdclient = MpdClient(mpdconf)

    #Mock the mpd client
    mpdmock=Mock()
    mpdclient.client=mpdmock
    #Mock the connect method
    disconnect=Mock(side_effect=ConnectionError())
    mpdmock.disconnect=disconnect

    # Call
    mpdclient.disconnect()