Ejemplo n.º 1
0
 def test_config_bad_port(self, mock_gf):
     config = {
         'graphite': {
             'host': 'foo',
             'port': 'wrong',
         }
     }
     self.assertFalse(graphite.setup(self.hass, config))
     self.assertFalse(mock_gf.called)
Ejemplo n.º 2
0
 def test_config_bad_port(self, mock_gf):
     config = {
         'graphite': {
             'host': 'foo',
             'port': 'wrong',
         }
     }
     self.assertFalse(graphite.setup(self.hass, config))
     self.assertFalse(mock_gf.called)
Ejemplo n.º 3
0
 def test_full_config(self, mock_gf):
     config = {
         'graphite': {
             'host': 'foo',
             'port': 123,
             'prefix': 'me',
         }
     }
     self.assertTrue(graphite.setup(self.hass, config))
     mock_gf.assert_called_once_with(self.hass, 'foo', 123, 'me')
Ejemplo n.º 4
0
 def test_full_config(self, mock_gf):
     config = {
         'graphite': {
             'host': 'foo',
             'port': 123,
             'prefix': 'me',
         }
     }
     self.assertTrue(graphite.setup(self.hass, config))
     mock_gf.assert_called_once_with(self.hass, 'foo', 123, 'me')
Ejemplo n.º 5
0
    def test_config_port(self, mock_gf, mock_socket):
        """Test setup with invalid port."""
        config = {
            'graphite': {
                'host': 'foo',
                'port': 2003,
            }
        }

        self.assertTrue(graphite.setup(self.hass, config))
        self.assertTrue(mock_gf.called)
        mock_socket.assert_called_once_with(socket.AF_INET, socket.SOCK_STREAM)
Ejemplo n.º 6
0
    def test_config_port(self, mock_gf, mock_socket):
        """Test setup with invalid port."""
        config = {
            'graphite': {
                'host': 'foo',
                'port': 2003,
            }
        }

        self.assertTrue(graphite.setup(self.hass, config))
        self.assertTrue(mock_gf.called)
        mock_socket.assert_called_once_with(socket.AF_INET, socket.SOCK_STREAM)
Ejemplo n.º 7
0
    def test_full_config(self, mock_gf, mock_socket):
        """Test setup with full configuration."""
        config = {
            'graphite': {
                'host': 'foo',
                'port': 123,
                'prefix': 'me',
            }
        }

        self.assertTrue(graphite.setup(self.hass, config))
        mock_gf.assert_called_once_with(self.hass, 'foo', 123, 'me')
        mock_socket.assert_called_once_with(socket.AF_INET, socket.SOCK_STREAM)
Ejemplo n.º 8
0
    def test_full_config(self, mock_gf, mock_socket):
        """Test setup with full configuration."""
        config = {
            'graphite': {
                'host': 'foo',
                'port': 123,
                'prefix': 'me',
            }
        }

        self.assertTrue(graphite.setup(self.hass, config))
        mock_gf.assert_called_once_with(self.hass, 'foo', 123, 'me')
        mock_socket.assert_called_once_with(socket.AF_INET, socket.SOCK_STREAM)
Ejemplo n.º 9
0
 def test_minimal_config(self, mock_gf):
     """Test setup with minimal configuration."""
     self.assertTrue(graphite.setup(self.hass, {}))
     mock_gf.assert_called_once_with(self.hass, 'localhost', 2003, 'ha')
Ejemplo n.º 10
0
 def test_minimal_config(self, mock_gf):
     self.assertTrue(graphite.setup(self.hass, {}))
     mock_gf.assert_called_once_with(self.hass, 'localhost', 2003, 'ha')