Ejemplo n.º 1
0
 def check_filter_url(self, url, expected_ids, expected_total):
     client = self.login(self.admin_name)
     resp = client.get(url,
                       headers={'Accept': 'application/json'},
                       follow_redirects=False)
     if resp.status_code == 301:
         # Manually follow redirects to keep the Accept header around.
         resp = client.get(resp.location,
                           headers={'Accept': 'application/json'},
                           follow_redirects=False)
     resp_obj = json.loads(resp.data)
     # Check that the returned requests match
     self.assertEqual(expected_ids,
                      {request['id']
                       for request in resp_obj['requests']})
     # Check that the totals add up properly (in a roundabout way)
     self.assertEqual(
         PrettyDecimal(expected_total).currency(),
         resp_obj['total_payouts'])
Ejemplo n.º 2
0
 def test_integer(self):
     pd = PrettyDecimal('123')
     self.assertEqual(pd.currency(), '123.00')
     self.assertEqual(pd, Decimal('123'))
Ejemplo n.º 3
0
 def test_three_decimal_places(self):
     pd = PrettyDecimal('123.456')
     self.assertEqual(pd.currency(), '123.46')
     self.assertEqual(pd, Decimal('123.456'))
Ejemplo n.º 4
0
 def test_integer(self):
     pd = PrettyDecimal('123')
     self.assertEqual(pd.currency(), '123.00')
     self.assertEqual(pd, Decimal('123'))
Ejemplo n.º 5
0
 def test_three_decimal_places(self):
     pd = PrettyDecimal('123.456')
     self.assertEqual(pd.currency(), '123.46')
     self.assertEqual(pd, Decimal('123.456'))
Ejemplo n.º 6
0
 def test_commas(self):
     pd = PrettyDecimal('12345')
     self.assertEqual(pd.currency(commas=True), '12,345.00')
     self.assertEqual(pd.currency(commas=False), '12345.00')