File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ coverage.xml
46
46
* .cover
47
47
.hypothesis /
48
48
.pytest_cache /
49
+ .vscode /
49
50
50
51
# Translations
51
52
* .mo
Original file line number Diff line number Diff line change
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 ()
You can’t perform that action at this time.
0 commit comments