-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
124 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__ | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh -e | ||
usage() { | ||
echo "Usage: $0 [-h]" 1>&2; | ||
echo " -h Display this help message." 1>&2; | ||
echo " -i Initialize virtual environment." 1>&2; | ||
exit 1; | ||
} | ||
|
||
while getopts "hi" opt; do | ||
case $opt in | ||
i) | ||
i=1 | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
done | ||
|
||
PYTHON=python3.9 | ||
|
||
if [ -n "$i" ]; then | ||
$PYTHON -m venv .venv | ||
fi | ||
source .venv/bin/activate | ||
if [ -n "$i" ]; then | ||
$PYTHON -m pip install -r requirements.txt | ||
fi | ||
$PYTHON -m unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_vtwsclib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import unittest | ||
|
||
from vtwsclib import Vtapi | ||
|
||
|
||
class TestVtapi(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
if not all(key in os.environ for key in ['VTIGER_HOST', 'VTIGER_USER', 'VTIGER_PASS']): | ||
cls.skipTest("environment variables not configured") | ||
|
||
def test_login(self): | ||
with Vtapi(os.environ['VTIGER_HOST']) as api: | ||
api.login(os.environ['VTIGER_USER'], os.environ['VTIGER_PASS']) | ||
|
||
def test_count(self): | ||
with Vtapi(os.environ['VTIGER_HOST']) as api: | ||
api.login(os.environ['VTIGER_USER'], os.environ['VTIGER_PASS']) | ||
self.assertGreater(api.count('Quotes'), 0) | ||
|
||
def test_retrieve(self): | ||
with Vtapi(os.environ['VTIGER_HOST']) as api: | ||
api.login(os.environ['VTIGER_USER'], os.environ['VTIGER_PASS']) | ||
self.assertIn('website', api.retrieve('CompanyDetails')[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters