-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
40 lines (33 loc) · 1.25 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import datetime
from OpinKerfiAutoTask.OkAutoTask import OkAutoTask
# Skoða https://atws.readthedocs.io/
def get_employee(employee):
"""Dæmi um upplýsingar frá employee objectinu"""
print("Nafn: " + employee.LastName)
print("Netfang: " + employee.Email)
print("Símanúmer: " + employee.MobilePhone)
# Hér byrjar test kóði sem notar OkAutoTask wrapper klassa
auto_task = OkAutoTask()
employees = auto_task.get_employee_by_email('[email protected]')
for employee in employees:
get_employee(employee)
# Fletta upp beiðni
tickets = auto_task.get_ticket_by_number('T20190308.0009')
for ticket in tickets:
print(ticket)
# Stofna miða
now = datetime.datetime.now()
my_ticket = auto_task.create_ticket(
title="Prufu Ticket frá Python API: " + str(now.hour) + str(now.minute),
description="Þessi beiðni var útbúin kl: " + str(now),
queue="Hýsing og netrekstur",
accountID=0,
ticketSource='Monitoring Alert',
ticketType='Alert',
ticketCategory='AEM Alert'
)
# Fletta upp nýstofnuðum ticket my_ticket
# Todo: Breyta þannig að skilað sé einni niðurstöðu af gerðini ticket en ekki enumeration obj. af ticketum.
tickets = auto_task.get_ticket_by_number(my_ticket.TicketNumber)
for ticket in tickets:
print(ticket)