def test_check_profile():
    # just do one check to make sure the plumbing is working
    # test_check_* functions above are more thorough and direct
    port_map = MockPhysicalPortMap()
    profile = {"streamCount": 1, "avgPacketSize": 1024,
               "avgFramesPerSecond": calc_max_fps(1, 1024)}
    confidence = check_profile(profile, port_map, "1.2.3.4/1/1", Confidence())
    assert confidence.percent == 0.0
    assert "reserved" in confidence.reason
def test_check_profile_unconnected():
    port_map = MockPhysicalPortMap()
    port_map.mock_has_physical_port = False
    profile = {"streamCount": 1, "avgPacketSize": 64, "avgFramesPerSecond": 1}
    confidence = check_profile(profile, port_map, "1.2.3.4/1/1",
                               Confidence(100.0, "old reason"))
    assert confidence.percent == 0.0
    assert "old reason" in confidence.reason
    assert "connect" in confidence.reason
def calc_confidence(profile, port_map, location):
    confidence = traffic_check.Confidence()
    confidence = traffic_check.check_profile(profile, port_map, location,
                                             confidence)
    return confidence