def test_pryke_folder(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/folders/IEAGIITRI4AYHYMV') f = pryke.folder("IEAGIITRI4AYHYMV") assert isinstance(f, Folder) assert f.id == "IEAGIITRI4AYHYMV"
def test_pryke_tasks(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks') t = None for task in pryke.tasks(): t = task assert isinstance(task, Task) assert t.id == "IEAGIITRKQAYHYM5"
def test_pryke_accounts(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts') for account in pryke.accounts(): assert isinstance(account, Account) assert account.id == "IEAGIITR" url = urlparse(pryke._response.url) assert url.path == '/api/v3/accounts'
def test_attachment_author(attachment): """ author method of Attachment object. Args: attachment (pryke.Attachment): Attachment to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/users/KUAJ25LD') assert isinstance(attachment.author, User) assert attachment.author.id == "KUAJ25LD"
def test_task_account(task): """ account method of Task object. Args: task (pryke.Task): Task to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR') assert isinstance(task.account, Account) assert task.account.id == 'IEAGIITR'
def test_comment_author(comment): """ author method of Comment object. Args: comment (pryke.Comment): Comment to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/users/KUAJ25LD') assert isinstance(comment.author, User) assert comment.author.id == 'KUAJ25LD'
def test_attachment_task(attachment): """ task method of Attachment object. Args: attachment (pryke.Attachment): Attachment to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6') assert isinstance(attachment.task, Task) assert attachment.task.id == "IEAGIITRKQAYHYM6"
def test_account_attachments(account): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR/attachments') start = datetime.datetime(2016, 10, 2, 16, 10, 47) end = datetime.datetime(2016, 10, 3, 16, 10, 47) for attachment in account.attachments(start, end): assert isinstance(attachment, Attachment) assert isinstance(attachment.created_date, datetime.datetime) assert isinstance(attachment.size, int) assert attachment.type == AttachmentType.WRIKE
def test_comment_task(comment): """ task method of Comment object. Args: comment (pryke.Comment): Comment to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6') assert isinstance(comment.task, Task) assert comment.task.id == 'IEAGIITRKQAYHYM6' assert comment.folder is None
def test_folder_attachments(folder): """ attachments method of Folder object. Args: folder (Folder): Folder object to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/folders/IEAGIITRI4AYHYMV/attachments') for attachment in folder.attachments(): assert isinstance(attachment, Attachment) assert attachment.id == "IEAGIITRIYACEGSM"
def test_folder_shared_users(folder): """ shared_users method of Folder object. Args: folder (Folder): Folder object to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/users/KUAJ25LD') for u in folder.shared_users(): assert isinstance(u, User) assert u.id == "KUAJ25LD"
def test_pryke_comment(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/comments/IEAGIITRIMBEVLZE') a = pryke.comment('IEAGIITRIMBEVLZE') assert isinstance(a, Comment) assert isinstance(a.id, str) assert a.id == "IEAGIITRIMBEVLZE" responses.add(responses.GET, 'https://www.wrike.com/api/v3/comments/BOGUS', status=404) a = pryke.comment('BOGUS') assert a is None
def test_task_attachments(task): """ attachments method of Task object. Args: task (pryke.Task): Task to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6/attachments') for attachment in task.attachments(): assert isinstance(attachment, Attachment) assert attachment.id == "IEAGIITRIYACEGSN" assert attachment.task_id == 'IEAGIITRKQAYHYM6'
def test_task_comments(task): """ comments method of Task object. Args: task (pryke.Task): Task to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6/comments') for comment in task.comments(): assert isinstance(comment, Comment) assert comment.id == "IEAGIITRIMBEVLZE" assert comment.task_id == 'IEAGIITRKQAYHYM6'
def test_pryke_attachment(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/attachments/IEAGIITRIYACEGSL') a = pryke.attachment('IEAGIITRIYACEGSL') assert isinstance(a, Attachment) assert isinstance(a.id, str) assert a.id == "IEAGIITRIYACEGSL" assert isinstance(a.created_date, datetime.datetime) responses.add(responses.GET, 'https://www.wrike.com/api/v3/attachments/BOGUS', status=404) a = pryke.attachment('BOGUS') assert a is None
def test_comment_folder(pryke): """ task method of Comment object. Args: comment (pryke.Comment): Comment to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/comments/IEAGIITRIMBEVLZD') add_response(responses.GET, 'https://www.wrike.com/api/v3/folders/IEAGIITRI4AYHYMV') comment = pryke.comment("IEAGIITRIMBEVLZD") assert isinstance(comment.folder, Folder) assert comment.folder.id == 'IEAGIITRI4AYHYMV' assert comment.task is None
def test_task_export(task): """ export method of Task object. Args: task (pryke.Task): Task to test. """ add_response(responses.GET, 'https://www.wrike.com/api/v3/users/KUAJ25LD') add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6/attachments') add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6/comments') assert task.export("test.html") assert os.path.exists("test.html") os.remove("test.html")
def test_pryke_version(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/version') major, minor = pryke.version assert isinstance(major, int) assert isinstance(minor, int)
def test_pryke_user(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/users/KUAJ25LD') u = pryke.user('KUAJ25LD') assert isinstance(u, User) assert u.id == "KUAJ25LD"
def test_group_account(group): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR') a = group.account() assert isinstance(a, Account) assert a.id == "IEAGIITR"
def test_pryke_task(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/tasks/IEAGIITRKQAYHYM6') t = pryke.task('IEAGIITRKQAYHYM6') assert isinstance(t, Task) assert t.id == 'IEAGIITRKQAYHYM6'
def test_account_folders(account): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR/folders') for folder in account.folders(): assert isinstance(folder, Folder) assert folder.id == "IEAGIITRI4AYHYMV"
def test_pryke_contacts(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/contacts') for contact in pryke.contacts(): assert isinstance(contact, Contact) assert contact.id == "KUAJ25LD"
def test_pryke_comments(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/comments') for comment in pryke.comments(): assert isinstance(comment, Comment) assert comment.id == "IEAGIITRIMBEVLZE"
def test_account_groups(account): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR/groups') for group in account.groups(): assert isinstance(group, Group) assert group.id == "KX7ZHLB5"
def test_account_tasks(account): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR/tasks') for task in account.tasks(): assert isinstance(task, Task) assert task.id == "IEAGIITRKQAYHYM4"
def test_pryke_contact(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/contacts/KUAJ25LC') c = pryke.contact('KUAJ25LC') assert isinstance(c, Contact) assert c.id == "KUAJ25LC"
def test_pryke_folders(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/folders') for folder in pryke.folders(): assert isinstance(folder, Folder) assert folder.id == "IEAGIITRI4AYHYMV"
def test_pryke_group(pryke): add_response(responses.GET, 'https://www.wrike.com/api/v3/groups/KX7ZHLB5') g = pryke.group('KX7ZHLB5') assert isinstance(g, Group) assert g.id == "KX7ZHLB5"
def test_account_contacts(account): add_response(responses.GET, 'https://www.wrike.com/api/v3/accounts/IEAGIITR/contacts') for contact in account.contacts(): assert isinstance(contact, Contact) assert contact.id == "KX7ZHLB6"