Ejemplo n.º 1
0
    def test_get_order(self, rget):
        def mocked_get(url, headers):
            ok_(settings.REV_BASE_URL in url)
            ok_(settings.REV_CLIENT_API_KEY in headers['Authorization'])
            ok_(settings.REV_USER_API_KEY in headers['Authorization'])
            return Response({
                'attachments': [{
                    'id':
                    'fyKpNl7bAgAAAAAA',
                    'kind':
                    'caption',
                    'links': [{
                        'content-type':
                        'text/x-rev-caption',
                        'href': ('https://example.com/api/v1/attachments/'
                                 'fyKpNl7bAgAAAAAA/content'),
                        'rel':
                        'content'
                    }],
                    'name':
                    'sample_caption.srt',
                }],
                'caption': {
                    'total_length': 1,
                    'total_length_seconds': 60
                },
                'comments': [],
                'non_standard_tat_guarantee':
                False,
                'order_number':
                'CP000001',
                'price':
                1.0,
                'priority':
                'Normal',
                'status':
                'Complete'
            })

        rget.side_effect = mocked_get

        order = rev.get_order(settings.REV_BASE_URL +
                              '/api/v1/orders/CP000001')
        eq_(order['status'], 'Complete')
        eq_(order['order_number'], 'CP000001')
Ejemplo n.º 2
0
    def test_get_order(self, rget):
        def mocked_get(url, headers):
            ok_(settings.REV_BASE_URL in url)
            ok_(settings.REV_CLIENT_API_KEY in headers['Authorization'])
            ok_(settings.REV_USER_API_KEY in headers['Authorization'])
            return Response({
                'attachments': [{
                    'id': 'fyKpNl7bAgAAAAAA',
                    'kind': 'caption',
                    'links': [{
                        'content-type': 'text/x-rev-caption',
                        'href': (
                            'https://example.com/api/v1/attachments/'
                            'fyKpNl7bAgAAAAAA/content'
                            ),
                        'rel': 'content'
                    }],
                    'name': 'sample_caption.srt',
                }],
                'caption': {
                    'total_length': 1,
                    'total_length_seconds': 60
                },
                'comments': [],
                'non_standard_tat_guarantee': False,
                'order_number': 'CP000001',
                'price': 1.0,
                'priority': 'Normal',
                'status': 'Complete'
            })
        rget.side_effect = mocked_get

        order = rev.get_order(
            settings.REV_BASE_URL + '/api/v1/orders/CP000001'
        )
        eq_(order['status'], 'Complete')
        eq_(order['order_number'], 'CP000001')
Ejemplo n.º 3
0
 def get_order(self):
     return rev.get_order(self.uri)