コード例 #1
0
 def test_fetch_url_valid(self):
     '''Requires remote host to be accessible and responsive.'''
     txid = ('15796981d90b9ecbce09a9e8a7b4f447566f2f859b808f4e940fb3b6ac17d3'
             'd5')
     url = http.build_tx_url(txid)
     response = http.fetch_url(url)
     json_obj = json.loads(response)
     self.assertEqual(json_obj['ver'], 1)
コード例 #2
0
 def test_fetch_url_valid(self):
     '''Requires remote host to be accessible and responsive.'''
     txid = (
         '15796981d90b9ecbce09a9e8a7b4f447566f2f859b808f4e940fb3b6ac17d3'
         'd5')
     url = http.build_tx_url(txid)
     response = http.fetch_url(url)
     json_obj = json.loads(response)
     self.assertEqual(json_obj['ver'], 1)
コード例 #3
0
    def test_build_tx_url(self):
        """Build one URL to fetch tx data from blockchain.info."""
        txid = ('15796981d90b9ecbce09a9e8a7b4f447566f2f859b808f4e940fb3b6ac17d3'
                'd5')
        url = http.build_tx_url(txid)

        self.assertIn(
            ('https://blockchain.info/tx/15796981d90b9ecbce09a9e8a7b4f447566f2f'
             '859b808f4e940fb3b6ac17d3d5?format=json'),
            url,
            'should be valid url + optional api code set in cfg file.')
        api_key = 'scoobydoo'
        url = http.build_tx_url(txid=txid, api_key=api_key)
        self.assertEqual(url,
                         ('https://blockchain.info/tx/15796981d90b9ecbce09a9e8a'
                          '7b4f447566f2f859b808f4e940fb3b6ac17d3d5?'
                          'format=json&api_code=scoobydoo'),
                         'should be valid url using specified api code.')