~larry-e-works/uci-engine/amqp-to-kombu

« back to all changes in this revision

Viewing changes to lander/lander/tests/test_ticket_api.py

  • Committer: Larry Works
  • Date: 2014-09-30 18:08:31 UTC
  • mfrom: (762.1.55 uci-engine)
  • Revision ID: larry.works@canonical.com-20140930180831-cpztlnifhc47ah69
Massive merge from trunk, no conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        self.ticket = ticket_api.TicketApi('http://ts-url', '123')
52
52
 
53
53
    def test_add_artifact_default(self):
 
54
        # `Ticket` artifacts can be created and uses the context
 
55
        # 'ticket_id' (or UUID) to fetch the actual ticket 'resource_uri'
 
56
        # before posting.
54
57
        self.ticket._post = mock.Mock()
55
 
        post_url = 'http://ts-url/api/v1/ticketartifact/'
56
58
        self.ticket.add_artifact('name', 'url')
57
 
        data = {
58
 
            'type': 'LOGS',
59
 
            'name': 'name',
60
 
            'reference': 'url',
61
 
            'ticket': '/api/v1/ticket/123/'
62
 
        }
63
 
        self.ticket._post.assert_called_with(post_url, data)
 
59
        self.ticket._post.assert_called_with(
 
60
            'http://ts-url/api/v1/ticketartifact/',
 
61
            {'type': 'LOGS',
 
62
             'name': 'name',
 
63
             'reference': 'url',
 
64
             'ticket': '/api/v1/ticket/123/'})
64
65
 
65
66
    def test_add_artifact_subticket(self):
66
67
        self.ticket._post = mock.Mock()
235
236
        _m = mock.patch('lander.ticket_api.TicketApi._patch')
236
237
        self.mocked_patch = _m.start()
237
238
        self.addCleanup(_m.stop)
238
 
        self.api = ticket_api.TicketApi('<ts-server>', 1)
 
239
        self.api = ticket_api.TicketApi('http://ts-server:8080', '1')
239
240
 
240
241
    def assertPatched(self, details):
241
242
        """Assert the api patch method was invoked with the given details."""
247
248
        })
248
249
        # Assert patch method was invoked properly.
249
250
        self.mocked_patch.assert_called_once_with(
250
 
            '<ts-server>/api/v1/ticket/1/', data)
 
251
            'http://ts-server:8080/api/v1/ticket/1/', data)
251
252
 
252
253
    def test_set_ppacreation_waiting(self):
253
254
        # `set_ppacreation_waiting` patches ticket to: