~ubuntuone-hackers/ubuntu-rest-scopes/trunk

« back to all changes in this revision

Viewing changes to src/scopes/tests/test_ebay.py

  • Committer: Facundo Batista
  • Date: 2016-06-07 14:01:21 UTC
  • mfrom: (508.2.9 ubuntu-rest-scopes)
  • mto: This revision was merged to the branch mainline in revision 527.
  • Revision ID: facundo@taniquetil.com.ar-20160607140121-id1tzsnaa1lwtrb8
MergedĀ lp:~jamesh/ubuntu-rest-scopes/multi-column

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf8 -*-
 
1
# -*- coding: utf-8 -*-
2
2
 
3
3
# Copyright 2014-2016 Canonical
4
4
# All Rights Reserved
392
392
            response = list(app.preview(result=result, locale='en',
393
393
                                        partner=None))
394
394
 
 
395
        # check that column layout is sent first
 
396
        self.assertTrue('columns' in response[0])
 
397
 
395
398
        # check the 'image'
396
399
        should = dict(widget={
397
400
            'id': 'imagegallery',
399
402
            'sources': [(u'http://i.ebayimg.com/00/s/NTMxWDUzMQ==/'
400
403
                         'z/hlwAAOxydlFSuFyz/$_1.JPG?set_id=880000500F')],
401
404
        })
402
 
        self.assertEqual(response[0], should)
 
405
        self.assertEqual(response[1], should)
403
406
 
404
407
        # check the 'header'
405
408
        should = dict(widget={
409
412
            'subtitle': u'Current bid: 4.0',
410
413
            'attributes': [{'value': u'Shipping: $0.99'}],
411
414
        })
412
 
        self.assertEqual(response[1], should)
 
415
        self.assertEqual(response[2], should)
413
416
 
414
417
        # check the 'actions'
415
418
        should = dict(widget={
421
424
                         'Decals_Stickers_Vinyl_Art',
422
425
                         'label': 'View on eBay'}],
423
426
        })
424
 
        self.assertEqual(response[2], should)
 
427
        self.assertEqual(response[3], should)
425
428
 
426
429
        # check the 'info'
427
430
        should = dict(widget={
431
434
            'text': ('Time left: 26d 22h\nItem location: '
432
435
                     'West Palm Beach, Florida\nCondition: Pre-owned'),
433
436
        })
434
 
        self.assertEqual(response[3], should)
 
437
        self.assertEqual(response[4], should)
435
438
 
436
439
        # check the 'description'
437
440
        should_desc = 'Brand new set of all 5 books'
438
 
        self.assertTrue(response[4]['widget']['text'].startswith(should_desc))
 
441
        self.assertTrue(response[5]['widget']['text'].startswith(should_desc))
439
442
 
440
443
        # check the 'seller'
441
444
        should = dict(widget={
445
448
            'text': ('Sold by treebeardbooks (117300)\n'
446
449
                     'Feedback: 99.9% positive'),
447
450
        })
448
 
        self.assertEqual(response[5], should)
 
451
        self.assertEqual(response[6], should)
449
452
 
450
453
        # check the 'shipping and postage'
451
454
        should = dict(widget={
467
470
                     'be opened and still sealed.'),
468
471
        })
469
472
        self.maxDiff = None
470
 
        self.assertEqual(response[6], should)
 
473
        self.assertEqual(response[7], should)
471
474
 
472
475
    def test_preview_no_shipping_cost(self):
473
476
        # fake a previous result without shipping info in details
504
507
            'subtitle': u'Current bid: 4.0',
505
508
            'attributes': [{'value': None}],
506
509
        })
507
 
        self.assertEqual(response[1], should)
 
510
        self.assertEqual(response[2], should)
508
511
 
509
512
 
510
513
class DepartmentsTestCase(TestCase):