示例#1
0
 def setUp(self):
     self.created_ticket_name = self.random_name
     self.ticket = Ticket.create(self.email, self.first_name,
                                 self.last_name, self.created_ticket_name,
                                 self.ticket_text)
     self.ticket.update(Name=self.NEW_NAME)
     self.ticket = Ticket(self.ticket.id)
示例#2
0
    def test_actions_querylist(self):
        self.response.content = """<Actions>
                <Action>
                    <ID>ActionID</ID>
                    <TicketID>ID</TicketID>
                    <Name>Description</Name>
                </Action>
            </Actions>"""

        ticket = Ticket(data=self.ticket_element)

        actions = ticket.actions
        description_action = actions.get(Name='Description')
        self.assertIsInstance(description_action, Action)
        self.assertEqual(description_action.id, 'ActionID')
        self.assertEqual(description_action.ticket_id, 'ID')
示例#3
0
    def test_actions_property(self):
        self.response.content = """<Actions>
            <Action>
                <ID>ActionID</ID>
                <TicketID>ID</TicketID>
                <Name>Description</Name>
            </Action>
        </Actions>"""

        ticket = Ticket(data=self.ticket_element)

        actions = ticket.actions
        self.assertEqual(len(actions), 1)
        self.assertIsInstance(actions[0], Action)
        self.assertEqual(actions[0].id, 'ActionID')
        self.assertEqual(actions[0].ticket_id, 'ID')
        self.assertEqual(actions[0].Name, 'Description')
示例#4
0
 def setUp(self):
     self.returned_ticket = Ticket.create(self.email, self.first_name,
                                          self.last_name, self.ticket_name,
                                          self.ticket_text)
     self.ticket = Ticket(self.returned_ticket.id)
     self.contact = Contact.get(self.email)
示例#5
0
 def test_getattr(self):
     ticket_element = E.Ticket(E.TicketID('ID'), E.Field2('Test'))
     ticket = Ticket(data=ticket_element)
     self.assertEqual(ticket.Field2, 'Test')
示例#6
0
 def test_initialisation_with_data(self):
     ticket = Ticket(data=self.ticket_element)
     self.assertEqual(ticket.id, 'ID')
示例#7
0
 def test_initialisation_with_id(self):
     self.response.content = '<Ticket><TicketID>ID</TicketID></Ticket>'
     ticket = Ticket(ticket_id='ID')
     self.assertEqual(ticket.id, 'ID')