Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit aa31ebc

Browse files
author
Andrey Antukh
committed
Add initial py.test layout.
1 parent 168efa1 commit aa31ebc

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

pytest.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
looponfailroots = taiga_events
3+
; addopts = -n3

tests/__init__.py

Whitespace-only changes.

tests/test_basic.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from unittest.mock import patch
4+
from unittest.mock import MagicMock
5+
6+
import pytest
7+
8+
from taiga_events.handlers import *
9+
from taiga_events import repository
10+
from taiga_events import signing
11+
12+
13+
def test_parse_auth_message():
14+
secret_key = "mysecret"
15+
16+
token_data = {"token": signing.dumps({"user_id": 1}, key=secret_key),
17+
"project": 1}
18+
19+
auth_msg = parse_auth_message(secret_key, serialize_data(token_data))
20+
21+
assert isinstance(auth_msg, AuthMsg)
22+
assert auth_msg.token == token_data["token"]
23+
assert auth_msg.user_id == 1
24+
assert auth_msg.project_id == 1
25+
26+
# def test_is_subscription_allowed():
27+
# repo = repository.Repository(None, None)
28+
# mock_get_repository = asyncio.coroutine(MagicMock(return_value=repo))
29+
# mock_user_is_in_project = asyncio.coroutine(MagicMock(return_value=True))
30+
# with patch.object(repo, "get_repository", mock_get_repository):
31+

0 commit comments

Comments
 (0)