Skip to content

Commit 99539a2

Browse files
Akop KesheshyanAkop Kesheshyan
authored andcommitted
added unit tests
1 parent fb17f13 commit 99539a2

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ coverage.xml
4646
*.cover
4747
.hypothesis/
4848
.pytest_cache/
49+
.vscode/
4950

5051
# Translations
5152
*.mo

tests/__init__.py

Whitespace-only changes.

tests/test_bitrix24.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import unittest
2+
import os
3+
from bitrix24 import Bitrix24, BitrixError
4+
5+
6+
class Bitrix24Test(unittest.TestCase):
7+
8+
def setUp(self):
9+
self.b24 = Bitrix24(os.environ.get('TEST_DOMAIN'))
10+
11+
def test_call_post_method(self):
12+
r = self.b24.callMethod('crm.deal.add', fields={
13+
'TITLE': 'Hello World'})
14+
self.assertIs(type(r), int)
15+
16+
def test_call_get_method(self):
17+
r = self.b24.callMethod('crm.deal.list', filter={
18+
'TITLE': 'Hello World'})
19+
self.assertIs(type(r), list)
20+
21+
def test_call_with_empty_method(self):
22+
with self.assertRaises(BitrixError):
23+
self.b24.callMethod('')
24+
25+
def test_call_non_exists_method(self):
26+
with self.assertRaises(BitrixError):
27+
self.b24.callMethod('hello.world')
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()

0 commit comments

Comments
 (0)