예제 #1
0
    def test_wait_after_ddos_block(self, *args):
        configuration = BudaMarketConfig()
        configuration.btc = self.market_config

        buda = BudaIntegration(configuration)
        buda.should_log = False

        with mock.patch('core.BaseIntegration.requests.get',
                        side_effect=self.mock_request_get):
            self.should_block = True
            buda.recover_btc()

        self.assertEqual(args[0].call_count, 3)
        self.assertEqual(self.request_call_count, 3)
        self.assertTrue(self.market_config.recovered_all)
예제 #2
0
    def test_ending_after_last_stored_is_less_than_config(self, *args):
        configuration = BudaMarketConfig()
        self.market_config.last_stored_timestamp = get_entries_list()[10][0]
        self.market_config.recovered_all = True

        configuration.btc = self.market_config
        buda = BudaIntegration(configuration)
        buda.should_log = False

        with mock.patch('core.BaseIntegration.requests.get',
                        side_effect=self.mock_request_get):
            self.should_block = True
            buda.recover_btc()

        self.assertEqual(1, self.request_call_count)
예제 #3
0
    def test_executed_request_happy_case_not_recovered_all(self, *args):
        configuration = BudaMarketConfig()
        configuration.btc = self.market_config

        buda = BudaIntegration(configuration)
        # date utils gettz works as expected when used from cli, but fails when unittesting on
        # ubuntu (in windows works well) maybe it is related to mocking open() function (?)
        buda.should_log = False

        with mock.patch('core.BaseIntegration.requests.get',
                        side_effect=self.mock_request_get):
            buda.recover_btc()

        self.assertGreaterEqual(self.request_call_count, 3)
        self.assertTrue(self.market_config.recovered_all)