Exemplo n.º 1
0
    def setUp(self):
        self.query = 'from demo.ecommerce.data select * limit 1'
        self.app_name = "testing-app_name"
        self.uri = os.getenv('DEVO_API_ADDRESS',
                             'https://apiv2-us.devo.com/search/query')
        self.key = os.getenv('DEVO_API_KEY', None)
        self.secret = os.getenv('DEVO_API_SECRET', None)
        self.token = os.getenv('DEVO_AUTH_TOKEN', None)
        self.query_id = os.getenv('DEVO_API_QUERYID', None)
        self.user = os.getenv('DEVO_API_USER', "python-sdk-user")
        self.comment = os.getenv('DEVO_API_COMMENT', None)

        configuration = Configuration()
        configuration.set(
            "api", {
                "query": self.query,
                "address": self.uri,
                "key": self.key,
                "secret": self.secret,
                "token": self.token,
                "query_id": self.query_id,
                "user": self.user,
                "comment": self.comment,
                "app_name": self.app_name
            })
        self.config_path = "/tmp/devo_api_tests_config.json"
        configuration.save(path=self.config_path)
Exemplo n.º 2
0
    def setUp(self):
        self.address = os.getenv('DEVO_SENDER_SERVER', "0.0.0.0")
        self.port = int(os.getenv('DEVO_SENDER_PORT', 4488))
        self.tcp_address = os.getenv('DEVO_SENDER_TCP_SERVER', "0.0.0.0")
        self.tcp_port = int(os.getenv('DEVO_SENDER_TCP_PORT', 4489))

        self.key = os.getenv('DEVO_SENDER_KEY', CLIENT_KEY)
        self.cert = os.getenv('DEVO_SENDER_CERT', CLIENT_CERT)
        self.chain = os.getenv('DEVO_SENDER_CHAIN', CLIENT_CHAIN)

        self.local_key = os.getenv(CLIENT_KEY)
        self.test_tcp = os.getenv('DEVO_TEST_TCP', "True")
        self.my_app = 'test.drop.free'
        self.my_bapp = b'test.drop.free'
        self.my_date = 'my.date.test.sender'
        self.test_file = "".join((os.path.dirname(os.path.abspath(__file__)),
                                  os.sep, "testfile_multiline.txt"))

        self.test_msg = 'Test send msg\n'
        self.localhost = socket.gethostname()
        # change this value if you want to send another number of test string
        self.default_numbers_sendings = 10

        configuration = Configuration()
        configuration.set(
            "sender", {
                "key": self.key,
                "cert": self.cert,
                "chain": self.chain,
                "address": self.address,
                "port": self.port,
            })

        self.config_path = "/tmp/devo_sender_tests_config.json"
        configuration.save(path=self.config_path)
Exemplo n.º 3
0
    def test_save(self):
        config = Configuration(self.config_path + ".yaml")
        config.save(self.config_path + ".bak")

        if os.path.isfile(self.config_path + ".bak"):
            os.remove(self.config_path + ".bak")
            self.assertTrue(True)
        else:
            self.assertFalse(True)