Ejemplo n.º 1
0
    def test_market_trading_volume(self):

        # create markets
        market = MarketFactory()

        market_response_data = self.client.get(reverse('api:markets'),
                                               content_type='application/json')
        self.assertEqual(market_response_data.status_code, status.HTTP_200_OK)
        self.assertEqual(
            len(json.loads(market_response_data.content).get('results')), 1)

        self.assertEqual(
            json.loads(
                market_response_data.content)['results'][0]['tradingVolume'],
            "0")

        market.trading_volume = 12
        market.save()

        market_response_data2 = self.client.get(
            reverse('api:markets'), content_type='application/json')
        self.assertEqual(market_response_data2.status_code, status.HTTP_200_OK)
        self.assertEqual(
            len(json.loads(market_response_data2.content).get('results')), 1)

        self.assertEqual(
            json.loads(
                market_response_data2.content)['results'][0]['tradingVolume'],
            "12")
Ejemplo n.º 2
0
    def test_decimal_field_frontier_value(self):
        market = MarketFactory()
        market.funding = 2**256
        market.save()

        market_response_data = self.client.get(reverse('api:markets'),
                                               content_type='application/json')
        self.assertEqual(market_response_data.status_code, status.HTTP_200_OK)
        self.assertEqual(
            len(json.loads(market_response_data.content).get('results')), 1)

        self.assertEqual(
            str(market.funding),
            json.loads(market_response_data.content)['results'][0]['funding'])