Ejemplo n.º 1
0
 def test_parse_sensor_reading_standard_case(self):
     reading = SensorReading(  #
         ['lower non-critical threshold'], 1, "Hugo", None, "", [42],
         "hugo-type", None, 0)
     assert IPMIFetcher._parse_sensor_reading(  #
         0,
         reading) == [b"0", b"Hugo", b"hugo-type", b"N/A", b"", b"WARNING"]
Ejemplo n.º 2
0
 def fetcher(self, file_cache):
     return IPMIFetcher(
         file_cache,
         address="1.2.3.4",
         username="******",
         password="******",
     )
Ejemplo n.º 3
0
    def test_command_raises_IpmiException_handling(self, fc_agent,
                                                   monkeypatch):
        monkeypatch.setattr(IPMIFetcher, "open", lambda self: None)

        with pytest.raises(MKFetcherError):
            with IPMIFetcher(fc_agent, "127.0.0.1", "", ""):
                raise IpmiException()
Ejemplo n.º 4
0
 def test_parse_sensor_reading_false_positive(self):
     reading = SensorReading(  #
         ['Present'], 1, "Dingeling", 0.2, b"\xc2\xb0C", [], "FancyDevice",
         3.14159265, 1)
     assert IPMIFetcher._parse_sensor_reading(  #
         0, reading) == [
             b"0", b"Dingeling", b"FancyDevice", b"3.14", b"C", b"Present"
         ]
Ejemplo n.º 5
0
 def test_deserialization(self, fc_conf):
     fetcher = IPMIFetcher.from_json(
         json_identity({
             "file_cache": fc_conf.configure(),
             "address": "1.2.3.4",
             "username": "******",
             "password": "******",
         }))
     assert isinstance(fetcher, IPMIFetcher)
Ejemplo n.º 6
0
    def test_command_raises_IpmiException_handling(self, file_cache, monkeypatch):
        def open_(*args):
            raise IpmiException()

        monkeypatch.setattr(IPMIFetcher, "open", open_)

        with pytest.raises(MKFetcherError):
            with IPMIFetcher(
                    file_cache,
                    address="127.0.0.1",
                    username="",
                    password="",
            ):
                pass