コード例 #1
0
    def test_get_all_device_agents(self):
        """Testing function get_all_device_agents."""
        results = db_deviceagent.get_all_device_agents()

        # There should only be one item in the result list
        self.assertEqual(len(results), 1)

        # Verify values in only result item
        for result in results:
            for key, _ in result.items():
                self.assertEqual(result[key], self.expected[key])
コード例 #2
0
def db_devagt_get_all_device_agents():
    """Get all DeviceAgent data from the DB.

    Args:
        None

    Returns:
        Agent data

    """
    # Return
    data = db_deviceagent.get_all_device_agents()
    return jsonify(data)
コード例 #3
0
ファイル: deviceagents.py プロジェクト: OrandiH/infoset-ng
def db_devagt_get_all_device_agents():
    """Get all DeviceAgent data from the DB.

    Args:
        None

    Returns:
        Agent data

    """
    # Get data from cache
    key = ('DB/DeviceAgent')
    cache_value = CACHE.get(key)

    # Process cache miss
    if cache_value is None:
        data = db_deviceagent.get_all_device_agents()
        CACHE.set(key, data)
    else:
        data = cache_value

    # Return
    return jsonify(data)
コード例 #4
0
 def test_get_all_device_agents(self):
     """Testing function get_all_device_agents."""
     results = db_deviceagent.get_all_device_agents()
     for result in results:
         for key, _ in result.items():
             self.assertEqual(result[key], 1)