import unittest
import manage_sys_paths

from messaging.DummyMessageManager import DummyMessageManager
# init dummy message manager so no connection to rabbitmq is established
_ = DummyMessageManager.get_instance()

import routes.blockchain_trace as blockchain_trace

class Test_BlockchainTrace(unittest.TestCase):

    def _get_min_valid_input(self):
        return {
        "ApplicationType": "string"
        }

    def test_isBlockchainTraceValid_validInputAndTypes(self):
        input = self._get_min_valid_input()
        self.assertTrue(blockchain_trace.isBlockchainTraceValid(input), "Trace should be valid")

    def test_isBlockchainTraceValid_emptyInput(self):
        input = {}
        self.assertFalse(blockchain_trace.isBlockchainTraceValid(input), "Empty input should not be accepted")

    def test_isBlockchainTraceValid_additionalKeys(self):
        input = {
        "ApplicationType": "string",
        "Metadata": {},
        "ResourceIds": "string",
        "ResourceMd5": "string",
        "ResourceState": "string",
        "TransactionFrom": "string",
        "TransactionFromLatLng": "string",
        "TransactionId": "string",
        "TransactionTo": "string",
        "TransactionToLatLng": "string",
        "TransferredAsset": "string"
        }
        self.assertTrue(blockchain_trace.isBlockchainTraceValid(input), "Input should be accepted")

if __name__ == '__main__':
    unittest.main()