mirror of
https://github.com/retailcrm/api-client-python.git
synced 2025-04-12 13:31:00 +00:00
Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
|
9429f1574c | ||
|
f17fbc6801 | ||
|
bd3998f823 | ||
|
d0a558a8fe | ||
|
1c36f3464b | ||
|
2c7061d8bf | ||
|
3582b077f4 | ||
|
bfdb4cc554 | ||
|
27ff0849ec | ||
|
c52f95e95f | ||
|
7c9a81d135 | ||
|
d420bdb0b3 | ||
|
e3e3de9e4b | ||
|
b488af91c7 | ||
|
963e779172 | ||
|
f5b7e315bb | ||
|
4d25347f95 |
16 changed files with 238 additions and 213 deletions
67
.github/workflows/ci.yml
vendored
Normal file
67
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
tags-ignore:
|
||||||
|
- '*.*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
RETAILCRM_URL: https://test.retailcrm.pro
|
||||||
|
RETAILCRM_KEY: key
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ['3.8', '3.9', '3.10', '3.11']
|
||||||
|
include:
|
||||||
|
- python-version: '3.12'
|
||||||
|
coverage: 1
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
${{ runner.os }}-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install flake8
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
- name: Lint with flake8
|
||||||
|
run: |
|
||||||
|
# stop the build if there are Python syntax errors or undefined names
|
||||||
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||||
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=F401
|
||||||
|
- name: Tests
|
||||||
|
env:
|
||||||
|
COVERAGE: ${{ matrix.coverage }}
|
||||||
|
if: env.COVERAGE != 1
|
||||||
|
run: python -m unittest tests/*.py
|
||||||
|
- name: Tests with coverage
|
||||||
|
env:
|
||||||
|
COVERAGE: ${{ matrix.coverage }}
|
||||||
|
if: env.COVERAGE == 1
|
||||||
|
run: |
|
||||||
|
coverage run -m unittest tests/*.py
|
||||||
|
- name: Coverage
|
||||||
|
env:
|
||||||
|
COVERAGE: ${{ matrix.coverage }}
|
||||||
|
if: env.COVERAGE == 1
|
||||||
|
run: |
|
||||||
|
bash <(curl -s https://codecov.io/bash)
|
||||||
|
rm .coverage coverage.xml
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -5,4 +5,7 @@
|
||||||
/dist/
|
/dist/
|
||||||
/venv/
|
/venv/
|
||||||
/.vscode/
|
/.vscode/
|
||||||
/build/
|
/build/
|
||||||
|
.python-version
|
||||||
|
.coverage
|
||||||
|
coverage.xml
|
13
.travis.yml
13
.travis.yml
|
@ -1,13 +0,0 @@
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- '3.4'
|
|
||||||
- '3.5'
|
|
||||||
- '3.6'
|
|
||||||
- '3.7'
|
|
||||||
- '3.8'
|
|
||||||
before_install:
|
|
||||||
- pip install -r requirements.txt
|
|
||||||
script:
|
|
||||||
- nosetests -v --with-coverage --cover-xml
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2015-2018 RetailDriver LLC
|
Copyright (c) 2015-2021 RetailDriver LLC
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
21
README
21
README
|
@ -1,7 +1,7 @@
|
||||||
retailCRM python API client
|
RetailCRM python API client
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
This is python retailCRM API client. This library allows to use all
|
This is python RetailCRM API client. This library allows to use all
|
||||||
available API versions.
|
available API versions.
|
||||||
|
|
||||||
Install
|
Install
|
||||||
|
@ -9,7 +9,7 @@ Install
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
pip install retailcrm
|
pip3 install retailcrm
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
@ -22,7 +22,7 @@ Usage
|
||||||
import retailcrm
|
import retailcrm
|
||||||
|
|
||||||
|
|
||||||
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
client = retailcrm.v3('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
||||||
|
|
||||||
order = {
|
order = {
|
||||||
'firstName': 'John',
|
'firstName': 'John',
|
||||||
|
@ -42,7 +42,7 @@ Usage
|
||||||
import retailcrm
|
import retailcrm
|
||||||
|
|
||||||
|
|
||||||
client = retailcrm.v4('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
client = retailcrm.v4('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
||||||
|
|
||||||
result = client.customers_history(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
|
result = client.customers_history(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Usage
|
||||||
import retailcrm
|
import retailcrm
|
||||||
|
|
||||||
|
|
||||||
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
client = retailcrm.v5('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
||||||
site = 'example-com'
|
site = 'example-com'
|
||||||
task = {
|
task = {
|
||||||
'text': 'Product availability problem',
|
'text': 'Product availability problem',
|
||||||
|
@ -68,12 +68,3 @@ Usage
|
||||||
}
|
}
|
||||||
|
|
||||||
result = client.task_create(task, site)
|
result = client.task_create(task, site)
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
- `English`_
|
|
||||||
- `Russian`_
|
|
||||||
|
|
||||||
.. _English: https://help.retailcrm.pro/Developers/Index
|
|
||||||
.. _Russian: https://help.retailcrm.ru/Developers/Index
|
|
||||||
|
|
27
README.md
27
README.md
|
@ -1,18 +1,18 @@
|
||||||
[](https://travis-ci.org/retailcrm/api-client-python)
|
[](https://github.com/retailcrm/api-client-python/actions)
|
||||||
[](https://codecov.io/gh/retailcrm/api-client-python)
|
[](https://codecov.io/gh/retailcrm/api-client-python)
|
||||||
[](https://pypi.python.org/pypi/retailcrm)
|
[](https://pypi.python.org/pypi/retailcrm)
|
||||||
[](https://pypi.python.org/pypi/retailcrm)
|
[](https://pypi.python.org/pypi/retailcrm)
|
||||||
|
|
||||||
|
|
||||||
retailCRM python API client
|
RetailCRM python API client
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
This is python retailCRM API client. This library allows to use all available API versions.
|
This is Python RetailCRM API client. This library allows to use all available API versions.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install retailcrm
|
pip3 install retailcrm
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -25,7 +25,7 @@ pip install retailcrm
|
||||||
import retailcrm
|
import retailcrm
|
||||||
|
|
||||||
|
|
||||||
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
client = retailcrm.v3('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
||||||
|
|
||||||
order = {
|
order = {
|
||||||
'firstName': 'John',
|
'firstName': 'John',
|
||||||
|
@ -46,9 +46,9 @@ result = client.order_create(order)
|
||||||
import retailcrm
|
import retailcrm
|
||||||
|
|
||||||
|
|
||||||
client = retailcrm.v4('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
client = retailcrm.v4('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
||||||
|
|
||||||
result = client.customers_history(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
|
result = client.customers_history(filters={'sinceId': '1500', 'startDate': '2018-03-01'})
|
||||||
|
|
||||||
print(result['pagination']['totalCount'])
|
print(result['pagination']['totalCount'])
|
||||||
```
|
```
|
||||||
|
@ -61,7 +61,7 @@ print(result['pagination']['totalCount'])
|
||||||
import retailcrm
|
import retailcrm
|
||||||
|
|
||||||
|
|
||||||
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
client = retailcrm.v5('https://demo.retailcrm.pro', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
|
||||||
site = 'example-com'
|
site = 'example-com'
|
||||||
task = {
|
task = {
|
||||||
'text': 'Product availability problem',
|
'text': 'Product availability problem',
|
||||||
|
@ -74,8 +74,3 @@ task = {
|
||||||
|
|
||||||
result = client.task_create(task, site)
|
result = client.task_create(task, site)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
* [English](https://help.retailcrm.pro/Developers/Index)
|
|
||||||
* [Russian](https://help.retailcrm.ru/Developers/Index)
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
multidimensional-urlencode==0.0.4
|
multidimensional-urlencode==0.0.4
|
||||||
nose==1.3.7
|
nose==1.3.7
|
||||||
requests==2.24.0
|
requests==2.32.1
|
||||||
coverage==5.2.1
|
coverage==4.5.4
|
||||||
pook==1.0.1
|
pook==1.3.0
|
||||||
setuptools==49.6.0
|
setuptools==70.0.0
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Init
|
Init
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -11,7 +11,7 @@ from retailcrm.response import Response
|
||||||
|
|
||||||
|
|
||||||
class Base(object):
|
class Base(object):
|
||||||
"""retailCRM API client"""
|
"""RetailCRM API client"""
|
||||||
|
|
||||||
def __init__(self, crm_url, api_key, version):
|
def __init__(self, crm_url, api_key, version):
|
||||||
self.api_url = crm_url + '/api'
|
self.api_url = crm_url + '/api'
|
||||||
|
@ -30,6 +30,7 @@ class Base(object):
|
||||||
requests_url = base_url + url if not self.parameters else base_url + url + "?" + query_builder(self.parameters)
|
requests_url = base_url + url if not self.parameters else base_url + url + "?" + query_builder(self.parameters)
|
||||||
response = requests.get(requests_url, headers={
|
response = requests.get(requests_url, headers={
|
||||||
'X-API-KEY': self.api_key})
|
'X-API-KEY': self.api_key})
|
||||||
|
self.parameters = {}
|
||||||
|
|
||||||
return Response(response.status_code, response.json())
|
return Response(response.status_code, response.json())
|
||||||
|
|
||||||
|
@ -42,7 +43,8 @@ class Base(object):
|
||||||
requests_url = base_url + url
|
requests_url = base_url + url
|
||||||
response = requests.post(requests_url, data=self.parameters, headers={
|
response = requests.post(requests_url, data=self.parameters, headers={
|
||||||
'X-API-KEY': self.api_key})
|
'X-API-KEY': self.api_key})
|
||||||
|
self.parameters = {}
|
||||||
|
|
||||||
return Response(response.status_code, response.json())
|
return Response(response.status_code, response.json())
|
||||||
|
|
||||||
def api_versions(self):
|
def api_versions(self):
|
||||||
|
|
|
@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
|
||||||
|
|
||||||
|
|
||||||
class Client(Base):
|
class Client(Base):
|
||||||
"""retailCRM API client"""
|
"""RetailCRM API client"""
|
||||||
|
|
||||||
apiVersion = 'v3'
|
apiVersion = 'v3'
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ class Client(Base):
|
||||||
"""
|
"""
|
||||||
if site is not None:
|
if site is not None:
|
||||||
self.parameters['site'] = site
|
self.parameters['site'] = site
|
||||||
|
|
||||||
self.parameters['offers'] = json.dumps(offers)
|
self.parameters['offers'] = json.dumps(offers)
|
||||||
|
|
||||||
return self.post('/store/inventories/upload')
|
return self.post('/store/inventories/upload')
|
||||||
|
@ -532,5 +532,5 @@ class Client(Base):
|
||||||
"""
|
"""
|
||||||
:return: Response
|
:return: Response
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self.get('/statistic/update')
|
return self.get('/statistic/update')
|
||||||
|
|
|
@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
|
||||||
|
|
||||||
|
|
||||||
class Client(Base):
|
class Client(Base):
|
||||||
"""retailCRM API client"""
|
"""RetailCRM API client"""
|
||||||
|
|
||||||
apiVersion = 'v4'
|
apiVersion = 'v4'
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from retailcrm.versions.base import Base
|
||||||
|
|
||||||
|
|
||||||
class Client(Base):
|
class Client(Base):
|
||||||
"""retailCRM API client"""
|
"""RetailCRM API client"""
|
||||||
|
|
||||||
apiVersion = 'v5'
|
apiVersion = 'v5'
|
||||||
|
|
||||||
|
@ -504,11 +504,15 @@ class Client(Base):
|
||||||
if site is not None:
|
if site is not None:
|
||||||
self.parameters['site'] = site
|
self.parameters['site'] = site
|
||||||
|
|
||||||
return self.post('/customers-corporate/' +
|
return self.post("".join(
|
||||||
str(uid_corporate) +
|
[
|
||||||
'/addresses/' +
|
'/customers-corporate/',
|
||||||
str(address[entity_by]) +
|
str(uid_corporate),
|
||||||
'/edit')
|
'/addresses/',
|
||||||
|
str(address[entity_by]),
|
||||||
|
'/edit'
|
||||||
|
]
|
||||||
|
))
|
||||||
|
|
||||||
def customer_corporate_companies(self, uid, uid_type='externalId', limit=20, page=1, filters=None, site=None):
|
def customer_corporate_companies(self, uid, uid_type='externalId', limit=20, page=1, filters=None, site=None):
|
||||||
"""
|
"""
|
||||||
|
@ -575,8 +579,7 @@ class Client(Base):
|
||||||
if site is not None:
|
if site is not None:
|
||||||
self.parameters['site'] = site
|
self.parameters['site'] = site
|
||||||
|
|
||||||
return self.post('/customers-corporate/' +
|
return self.post('/customers-corporate/' + str(uid_corporate) + '/companies/' + str(company[entity_by]) + '/edit')
|
||||||
str(uid_corporate) + '/companies/' + str(company[entity_by]) + '/edit')
|
|
||||||
|
|
||||||
def customer_corporate_contacts(self, uid, uid_type='externalId', limit=20, page=1, filters=None, site=None):
|
def customer_corporate_contacts(self, uid, uid_type='externalId', limit=20, page=1, filters=None, site=None):
|
||||||
"""
|
"""
|
||||||
|
@ -643,8 +646,7 @@ class Client(Base):
|
||||||
if site is not None:
|
if site is not None:
|
||||||
self.parameters['site'] = site
|
self.parameters['site'] = site
|
||||||
|
|
||||||
return self.post('/customers-corporate/' +
|
return self.post('/customers-corporate/' + str(uid_corporate) + '/contacts/' + str(contact[entity_by]) + '/edit')
|
||||||
str(uid_corporate) + '/contacts/' + str(contact[entity_by]) + '/edit')
|
|
||||||
|
|
||||||
def customer_corporate_edit(self, customer_corporate, uid_type='externalId', site=None):
|
def customer_corporate_edit(self, customer_corporate, uid_type='externalId', site=None):
|
||||||
"""
|
"""
|
||||||
|
|
16
setup.py
16
setup.py
|
@ -15,12 +15,12 @@ def read(filename):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='retailcrm',
|
name='retailcrm',
|
||||||
version='5.1.0',
|
version='5.1.2',
|
||||||
description='retailCRM API client',
|
description='RetailCRM API client',
|
||||||
long_description=read('README'),
|
long_description=read('README'),
|
||||||
url='https://github.com/retailcrm/api-client-python',
|
url='https://github.com/retailcrm/api-client-python',
|
||||||
author='retailCRM',
|
author='RetailCRM',
|
||||||
author_email='integration@retailcrm.ru',
|
author_email='support@retailcrm.pro',
|
||||||
keywords='crm saas rest e-commerce',
|
keywords='crm saas rest e-commerce',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
packages=['retailcrm', 'retailcrm/versions'],
|
packages=['retailcrm', 'retailcrm/versions'],
|
||||||
|
@ -34,11 +34,11 @@ setup(
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.4',
|
|
||||||
'Programming Language :: Python :: 3.5',
|
|
||||||
'Programming Language :: Python :: 3.6',
|
|
||||||
'Programming Language :: Python :: 3.7',
|
|
||||||
'Programming Language :: Python :: 3.8',
|
'Programming Language :: Python :: 3.8',
|
||||||
|
'Programming Language :: Python :: 3.9',
|
||||||
|
'Programming Language :: Python :: 3.10',
|
||||||
|
'Programming Language :: Python :: 3.11',
|
||||||
|
'Programming Language :: Python :: 3.12',
|
||||||
'Programming Language :: Python :: 3 :: Only',
|
'Programming Language :: Python :: 3 :: Only',
|
||||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
retailCRM API client v3 tests
|
RetailCRM API client v3 tests
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -111,8 +111,7 @@ class TestVersion3(unittest.TestCase):
|
||||||
Setup
|
Setup
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.client = retailcrm.v3(
|
self.client = retailcrm.v3(os.getenv('RETAILCRM_URL'), os.getenv('RETAILCRM_KEY'))
|
||||||
os.getenv('RETAILCRM_URL'), os.getenv('RETAILCRM_KEY'))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dictionaryEncode(key, dictionary):
|
def dictionaryEncode(key, dictionary):
|
||||||
|
@ -124,7 +123,7 @@ class TestVersion3(unittest.TestCase):
|
||||||
V3 Test wrong api url
|
V3 Test wrong api url
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get('https://epoqq.retailcrm.ru' + '/api/v3/statistic/update')
|
(pook.get('https://epoqq.retailcrm.pro' + '/api/v3/statistic/update')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.reply(404)
|
.reply(404)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
|
@ -136,7 +135,7 @@ class TestVersion3(unittest.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
client = retailcrm.v3('https://epoqq.retailcrm.ru', os.getenv('RETAILCRM_KEY'))
|
client = retailcrm.v3('https://epoqq.retailcrm.pro', os.getenv('RETAILCRM_KEY'))
|
||||||
response = client.statistic_update()
|
response = client.statistic_update()
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -169,7 +168,6 @@ class TestVersion3(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v3/statistic/update')
|
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v3/statistic/update')
|
||||||
.headers({'X-API-KEY': None})
|
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'errorMsg': '"apiKey" is missing.'})
|
.json({'errorMsg': '"apiKey" is missing.'})
|
||||||
|
@ -1509,13 +1507,7 @@ class TestVersion3(unittest.TestCase):
|
||||||
|
|
||||||
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v3/telephony/call/event')
|
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v3/telephony/call/event')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.body(urlencode(
|
.body(urlencode({'hangupStatus': 'busy', 'phone': '+799999999', 'code': 'c2321', 'type': 'hangup'}))
|
||||||
{
|
|
||||||
'hangupStatus': 'busy',
|
|
||||||
'phone': '+799999999',
|
|
||||||
'code': 'c2321',
|
|
||||||
'type': 'hangup'
|
|
||||||
}))
|
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'success': 'true'})
|
.json({'success': 'true'})
|
||||||
|
@ -1572,7 +1564,7 @@ class TestVersion3(unittest.TestCase):
|
||||||
'firstName': 'yyy',
|
'firstName': 'yyy',
|
||||||
'lastName': 'xxxx',
|
'lastName': 'xxxx',
|
||||||
'patronymic': 's789',
|
'patronymic': 's789',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'code': 'ccc7'
|
'code': 'ccc7'
|
||||||
},
|
},
|
||||||
'customer': {
|
'customer': {
|
||||||
|
@ -1581,7 +1573,7 @@ class TestVersion3(unittest.TestCase):
|
||||||
'firstName': 'ccc',
|
'firstName': 'ccc',
|
||||||
'lastName': 's789',
|
'lastName': 's789',
|
||||||
'patronymic': 's789',
|
'patronymic': 's789',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'code': 'ccc7',
|
'code': 'ccc7',
|
||||||
'phones': [{'number': '+71111111111'}]
|
'phones': [{'number': '+71111111111'}]
|
||||||
},
|
},
|
||||||
|
@ -1609,21 +1601,20 @@ class TestVersion3(unittest.TestCase):
|
||||||
|
|
||||||
code = 'xxx'
|
code = 'xxx'
|
||||||
|
|
||||||
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v3/telephony/settings/' + code)
|
(
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
pook.post(os.getenv('RETAILCRM_URL') + '/api/v3/telephony/settings/' + code)
|
||||||
.body(urlencode(
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
{
|
.body(urlencode({
|
||||||
'code': code,
|
'code': code,
|
||||||
'clientId': '123x',
|
'clientId': '123x',
|
||||||
'makeCallUrl': 'url',
|
'makeCallUrl': 'url',
|
||||||
'active': 'active',
|
'active': 'active',
|
||||||
'name': 'name',
|
'name': 'name',
|
||||||
'image': 'url_image'
|
'image': 'url_image'}))
|
||||||
}))
|
.reply(201)
|
||||||
.reply(201)
|
.headers(self.__header)
|
||||||
.headers(self.__header)
|
.json({'success': 'true'})
|
||||||
.json({'success': 'true'})
|
)
|
||||||
)
|
|
||||||
|
|
||||||
response = self.client.telephony_settings(code, '123x', 'url', 'active', 'name', 'url_image')
|
response = self.client.telephony_settings(code, '123x', 'url', 'active', 'name', 'url_image')
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
retailCRM API client v4 tests
|
RetailCRM API client v4 tests
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -107,8 +107,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
Setup
|
Setup
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.client = retailcrm.v4(
|
self.client = retailcrm.v4(os.getenv('RETAILCRM_URL'), os.getenv('RETAILCRM_KEY'))
|
||||||
os.getenv('RETAILCRM_URL'), os.getenv('RETAILCRM_KEY'))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dictionaryEncode(key, dictionary):
|
def dictionaryEncode(key, dictionary):
|
||||||
|
@ -120,7 +119,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
V4 Test wrong api url
|
V4 Test wrong api url
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get('https://epoqq.retailcrm.ru' + '/api/v4/statistic/update')
|
(pook.get('https://epoqq.retailcrm.pro' + '/api/v4/statistic/update')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.reply(404)
|
.reply(404)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
|
@ -132,7 +131,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
client = retailcrm.v4('https://epoqq.retailcrm.ru', os.getenv('RETAILCRM_KEY'))
|
client = retailcrm.v4('https://epoqq.retailcrm.pro', os.getenv('RETAILCRM_KEY'))
|
||||||
response = client.statistic_update()
|
response = client.statistic_update()
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -165,7 +164,6 @@ class TestVersion4(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v4/statistic/update')
|
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v4/statistic/update')
|
||||||
.headers({'X-API-KEY': None})
|
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'errorMsg': '"apiKey" is missing.'})
|
.json({'errorMsg': '"apiKey" is missing.'})
|
||||||
|
@ -310,11 +308,11 @@ class TestVersion4(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.customers_history(
|
response = self.client.customers_history(
|
||||||
{
|
{
|
||||||
'sinceId': '1111',
|
'sinceId': '1111',
|
||||||
'startDate': '2016-01-07',
|
'startDate': '2016-01-07',
|
||||||
'endDate': '2020-04-12'
|
'endDate': '2020-04-12'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -710,11 +708,11 @@ class TestVersion4(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.orders_history(
|
response = self.client.orders_history(
|
||||||
{
|
{
|
||||||
'sinceId': '1111',
|
'sinceId': '1111',
|
||||||
'startDate': '2016-01-07',
|
'startDate': '2016-01-07',
|
||||||
'endDate': '2020-04-12'
|
'endDate': '2020-04-12'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -1690,7 +1688,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
|
|
||||||
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v4/store/inventories')
|
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v4/store/inventories')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.params({'filter[site]': 'https://retailcrm.ru'})
|
.params({'filter[site]': 'https://retailcrm.pro'})
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json(
|
.json(
|
||||||
|
@ -1706,13 +1704,13 @@ class TestVersion4(unittest.TestCase):
|
||||||
{
|
{
|
||||||
'id': 33937,
|
'id': 33937,
|
||||||
'externalId': 'werew',
|
'externalId': 'werew',
|
||||||
'site': 'https://retailcrm.ru',
|
'site': 'https://retailcrm.pro',
|
||||||
'quantity': 102
|
'quantity': 102
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 33933,
|
'id': 33933,
|
||||||
'externalId': '46',
|
'externalId': '46',
|
||||||
'site': 'https://retailcrm.ru',
|
'site': 'https://retailcrm.pro',
|
||||||
'quantity': 0
|
'quantity': 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1720,7 +1718,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.inventories({'site': 'https://retailcrm.ru'})
|
response = self.client.inventories({'site': 'https://retailcrm.pro'})
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
self.assertTrue(response.is_successful(), True)
|
self.assertTrue(response.is_successful(), True)
|
||||||
|
@ -1981,7 +1979,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
'firstName': 'yyy',
|
'firstName': 'yyy',
|
||||||
'lastName': 'xxxx',
|
'lastName': 'xxxx',
|
||||||
'patronymic': 'www',
|
'patronymic': 'www',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'code': 'ccc7'
|
'code': 'ccc7'
|
||||||
},
|
},
|
||||||
'customer': {
|
'customer': {
|
||||||
|
@ -1990,7 +1988,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
'firstName': 'ccc',
|
'firstName': 'ccc',
|
||||||
'lastName': 'zzz',
|
'lastName': 'zzz',
|
||||||
'patronymic': 'sss',
|
'patronymic': 'sss',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'code': 'ccc7',
|
'code': 'ccc7',
|
||||||
'phones': [{'number': '+71111111111'}]
|
'phones': [{'number': '+71111111111'}]
|
||||||
},
|
},
|
||||||
|
@ -2027,7 +2025,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
{
|
{
|
||||||
'success': 'true',
|
'success': 'true',
|
||||||
'configuration': {
|
'configuration': {
|
||||||
'makeCallUrl': 'https://retailcrm.ru',
|
'makeCallUrl': 'https://retailcrm.pro',
|
||||||
'allowEdit': 'false',
|
'allowEdit': 'false',
|
||||||
'inputEventSupported': 'false',
|
'inputEventSupported': 'false',
|
||||||
'outputEventSupported': 'false',
|
'outputEventSupported': 'false',
|
||||||
|
@ -2056,7 +2054,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
configuration = {
|
configuration = {
|
||||||
'code': 'www',
|
'code': 'www',
|
||||||
'clientId': '5604',
|
'clientId': '5604',
|
||||||
'makeCallUrl': 'https://retailcrm.ru'
|
'makeCallUrl': 'https://retailcrm.pro'
|
||||||
}
|
}
|
||||||
|
|
||||||
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v4/telephony/setting/' + configuration['code'] + '/edit')
|
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v4/telephony/setting/' + configuration['code'] + '/edit')
|
||||||
|
@ -2150,7 +2148,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
'id': 777,
|
'id': 777,
|
||||||
'createdAt': '2020-04-05 11:23:46',
|
'createdAt': '2020-04-05 11:23:46',
|
||||||
'active': 'true',
|
'active': 'true',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'firstName': 'yyy',
|
'firstName': 'yyy',
|
||||||
'lastName': 'xxxx',
|
'lastName': 'xxxx',
|
||||||
'status': 'free',
|
'status': 'free',
|
||||||
|
@ -2189,7 +2187,7 @@ class TestVersion4(unittest.TestCase):
|
||||||
'id': 777,
|
'id': 777,
|
||||||
'createdAt': '2020-04-05 11:23:46',
|
'createdAt': '2020-04-05 11:23:46',
|
||||||
'active': 'true',
|
'active': 'true',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'firstName': 'yyy',
|
'firstName': 'yyy',
|
||||||
'lastName': 'xxxx',
|
'lastName': 'xxxx',
|
||||||
'status': 'free',
|
'status': 'free',
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
retailCRM API client v5 tests
|
RetailCRM API client v5 tests
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -189,8 +188,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
Setup
|
Setup
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.client = retailcrm.v5(
|
self.client = retailcrm.v5(os.getenv('RETAILCRM_URL'), os.getenv('RETAILCRM_KEY'))
|
||||||
os.getenv('RETAILCRM_URL'), os.getenv('RETAILCRM_KEY'))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dictionaryEncode(key, dictionary):
|
def dictionaryEncode(key, dictionary):
|
||||||
|
@ -202,7 +200,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
V5 Test wrong api url
|
V5 Test wrong api url
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get('https://epoqq.retailcrm.ru' + '/api/v5/statistic/update')
|
(pook.get('https://epoqq.retailcrm.pro' + '/api/v5/statistic/update')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.reply(404)
|
.reply(404)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
|
@ -214,7 +212,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
client = retailcrm.v5('https://epoqq.retailcrm.ru', os.getenv('RETAILCRM_KEY'))
|
client = retailcrm.v5('https://epoqq.retailcrm.pro', os.getenv('RETAILCRM_KEY'))
|
||||||
response = client.statistic_update()
|
response = client.statistic_update()
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -247,7 +245,6 @@ class TestVersion5(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/statistic/update')
|
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/statistic/update')
|
||||||
.headers({'X-API-KEY': None})
|
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'errorMsg': '"apiKey" is missing.'})
|
.json({'errorMsg': '"apiKey" is missing.'})
|
||||||
|
@ -413,7 +410,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
self.assertTrue(response.get_status_code() < 400, True)
|
self.assertTrue(response.get_status_code() < 400, True)
|
||||||
|
|
||||||
@pook.on
|
@pook.on
|
||||||
def test_costs_delete(self):
|
def test_costs_delete_v5(self):
|
||||||
"""
|
"""
|
||||||
V5 Test method costs_delete
|
V5 Test method costs_delete
|
||||||
"""
|
"""
|
||||||
|
@ -617,17 +614,18 @@ class TestVersion5(unittest.TestCase):
|
||||||
'elements': [{'name': 'fear', 'code': 'e456'}]
|
'elements': [{'name': 'fear', 'code': 'e456'}]
|
||||||
}
|
}
|
||||||
|
|
||||||
(pook.post(
|
(pook.post("".join(
|
||||||
os.getenv('RETAILCRM_URL') +
|
[
|
||||||
'/api/v5/custom-fields/dictionaries/' +
|
os.getenv('RETAILCRM_URL'),
|
||||||
custom_dictionary['code'] +
|
'/api/v5/custom-fields/dictionaries/',
|
||||||
'/edit')
|
custom_dictionary['code'],
|
||||||
|
'/edit'
|
||||||
|
]))
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.body(self.dictionaryEncode('customDictionary', custom_dictionary))
|
.body(self.dictionaryEncode('customDictionary', custom_dictionary))
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'success': 'true', 'code': 'test'})
|
.json({'success': 'true', 'code': 'test'}))
|
||||||
)
|
|
||||||
|
|
||||||
response = self.client.custom_dictionary_edit(custom_dictionary)
|
response = self.client.custom_dictionary_edit(custom_dictionary)
|
||||||
pook.off()
|
pook.off()
|
||||||
|
@ -883,12 +881,13 @@ class TestVersion5(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.customers_history(
|
response = self.client.customers_history(
|
||||||
{
|
{
|
||||||
'sinceId': '1111',
|
'sinceId': '1111',
|
||||||
'startDate': '2016-01-07',
|
'startDate': '2016-01-07',
|
||||||
'endDate': '2020-04-12'
|
'endDate': '2020-04-12'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
self.assertTrue(response.is_successful(), True)
|
self.assertTrue(response.is_successful(), True)
|
||||||
|
@ -1145,7 +1144,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
self.assertTrue(response.get_status_code() < 400, True)
|
self.assertTrue(response.get_status_code() < 400, True)
|
||||||
|
|
||||||
@pook.on
|
@pook.on
|
||||||
def test_customers_history(self):
|
def test_customers_history_v5(self):
|
||||||
"""
|
"""
|
||||||
V5 Test method customers_corporate_history
|
V5 Test method customers_corporate_history
|
||||||
"""
|
"""
|
||||||
|
@ -1199,11 +1198,11 @@ class TestVersion5(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.customers_corporate_history(
|
response = self.client.customers_corporate_history(
|
||||||
{
|
{
|
||||||
'sinceId': '1111',
|
'sinceId': '1111',
|
||||||
'startDate': '2016-01-07',
|
'startDate': '2016-01-07',
|
||||||
'endDate': '2020-04-12'
|
'endDate': '2020-04-12'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -1364,7 +1363,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
'success': 'true',
|
'success': 'true',
|
||||||
'addresses': [{
|
'addresses': [{
|
||||||
'id': 3995,
|
'id': 3995,
|
||||||
'text': '123123, Russian Federation, Moscow, Kutuzovski 14',
|
'text': '123123, Russian Federation, Moscow, Kubuntu 14',
|
||||||
'isMain': 'true',
|
'isMain': 'true',
|
||||||
'name': 'Test'
|
'name': 'Test'
|
||||||
}],
|
}],
|
||||||
|
@ -1392,15 +1391,12 @@ class TestVersion5(unittest.TestCase):
|
||||||
|
|
||||||
address = {'isMain': 'true', 'name': 'Test', 'externalId': 'cc_9'}
|
address = {'isMain': 'true', 'name': 'Test', 'externalId': 'cc_9'}
|
||||||
|
|
||||||
(pook.post(
|
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v5/customers-corporate/' + address['externalId'] + '/addresses/create')
|
||||||
os.getenv('RETAILCRM_URL') + '/api/v5/customers-corporate/' + address[
|
|
||||||
'externalId'] + '/addresses/create')
|
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.body(self.dictionaryEncode('address', address))
|
.body(self.dictionaryEncode('address', address))
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'success': 'true', 'id': 9717})
|
.json({'success': 'true', 'id': 9717}))
|
||||||
)
|
|
||||||
|
|
||||||
response = self.client.customer_corporate_addresses_create(address)
|
response = self.client.customer_corporate_addresses_create(address)
|
||||||
pook.off()
|
pook.off()
|
||||||
|
@ -1496,9 +1492,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
|
|
||||||
company = {'isMain': 'true', 'name': 'TestN', 'externalId': 'cc_9'}
|
company = {'isMain': 'true', 'name': 'TestN', 'externalId': 'cc_9'}
|
||||||
|
|
||||||
(pook.post(
|
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v5/customers-corporate/' + company['externalId'] + '/companies/create')
|
||||||
os.getenv('RETAILCRM_URL') + '/api/v5/customers-corporate/' + company[
|
|
||||||
'externalId'] + '/companies/create')
|
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.body(self.dictionaryEncode('company', company))
|
.body(self.dictionaryEncode('company', company))
|
||||||
.reply(200)
|
.reply(200)
|
||||||
|
@ -1588,9 +1582,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
|
|
||||||
contact = {'isMain': 'true', 'name': 'TestM', 'externalId': 'cc_9'}
|
contact = {'isMain': 'true', 'name': 'TestM', 'externalId': 'cc_9'}
|
||||||
|
|
||||||
(pook.post(
|
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v5/customers-corporate/' + contact['externalId'] + '/contacts/create')
|
||||||
os.getenv('RETAILCRM_URL') + '/api/v5/customers-corporate/' + contact[
|
|
||||||
'externalId'] + '/contacts/create')
|
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.body(self.dictionaryEncode('contact', contact))
|
.body(self.dictionaryEncode('contact', contact))
|
||||||
.reply(200)
|
.reply(200)
|
||||||
|
@ -1670,8 +1662,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
|
|
||||||
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v5/delivery/generic/' + code + '/tracking')
|
(pook.post(os.getenv('RETAILCRM_URL') + '/api/v5/delivery/generic/' + code + '/tracking')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.body(self.dictionaryEncode(
|
.body(self.dictionaryEncode('statusUpdate', delivery_id))
|
||||||
'statusUpdate', delivery_id))
|
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'success': 'true'})
|
.json({'success': 'true'})
|
||||||
|
@ -2007,30 +1998,29 @@ class TestVersion5(unittest.TestCase):
|
||||||
'currentPage': '1',
|
'currentPage': '1',
|
||||||
'totalPageCount': '87'
|
'totalPageCount': '87'
|
||||||
},
|
},
|
||||||
'integrationModule':
|
'integrationModule': {
|
||||||
{
|
'success': 'true',
|
||||||
'success': 'true',
|
'integrationModule': {
|
||||||
'integrationModule': {
|
'code': 'xxx',
|
||||||
'code': 'xxx',
|
'integrationCode': 'xxx',
|
||||||
'integrationCode': 'xxx',
|
'active': 'true',
|
||||||
'active': 'true',
|
'freeze': 'false',
|
||||||
'freeze': 'false',
|
'name': 'test',
|
||||||
'name': 'test',
|
'native': 'false',
|
||||||
'native': 'false',
|
'actions': {},
|
||||||
'actions': {},
|
'availableCountries': [],
|
||||||
'availableCountries': [],
|
'integrations': {
|
||||||
'integrations': {
|
'store': {
|
||||||
'store': {
|
'actions': [
|
||||||
'actions': [
|
{
|
||||||
{
|
'code': 'ccc',
|
||||||
'code': 'ccc',
|
'url': 'https://test'
|
||||||
'url': 'https://test'
|
}
|
||||||
}
|
]
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -2262,11 +2252,11 @@ class TestVersion5(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.orders_history(
|
response = self.client.orders_history(
|
||||||
{
|
{
|
||||||
'sinceId': '1111',
|
'sinceId': '1111',
|
||||||
'startDate': '2016-01-07',
|
'startDate': '2016-01-07',
|
||||||
'endDate': '2020-04-12'
|
'endDate': '2020-04-12'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
|
@ -2470,7 +2460,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
self.assertTrue(response.get_status_code() < 400, True)
|
self.assertTrue(response.get_status_code() < 400, True)
|
||||||
|
|
||||||
@pook.on
|
@pook.on
|
||||||
def test_orders_statuses(self):
|
def test_orders_statuses_v5(self):
|
||||||
"""
|
"""
|
||||||
V5 Test method orders_statuses
|
V5 Test method orders_statuses
|
||||||
"""
|
"""
|
||||||
|
@ -2502,7 +2492,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
self.assertTrue(response.get_status_code() < 400, True)
|
self.assertTrue(response.get_status_code() < 400, True)
|
||||||
|
|
||||||
@pook.on
|
@pook.on
|
||||||
def test_orders_upload(self):
|
def test_orders_upload_v5(self):
|
||||||
"""
|
"""
|
||||||
V5 Test method orders_upload
|
V5 Test method orders_upload
|
||||||
"""
|
"""
|
||||||
|
@ -2533,7 +2523,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
self.assertTrue(response.get_status_code() < 400, True)
|
self.assertTrue(response.get_status_code() < 400, True)
|
||||||
|
|
||||||
@pook.on
|
@pook.on
|
||||||
def test_order(self):
|
def test_order_v5(self):
|
||||||
"""
|
"""
|
||||||
V5 Test method order
|
V5 Test method order
|
||||||
"""
|
"""
|
||||||
|
@ -4020,7 +4010,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
|
|
||||||
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/store/inventories')
|
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/store/inventories')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.params({'filter[site]': 'https://retailcrm.ru'})
|
.params({'filter[site]': 'https://retailcrm.pro'})
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json(
|
.json(
|
||||||
|
@ -4036,13 +4026,13 @@ class TestVersion5(unittest.TestCase):
|
||||||
{
|
{
|
||||||
'id': 33937,
|
'id': 33937,
|
||||||
'externalId': '89387',
|
'externalId': '89387',
|
||||||
'site': 'https://retailcrm.ru',
|
'site': 'https://retailcrm.pro',
|
||||||
'quantity': 102
|
'quantity': 102
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': 33933,
|
'id': 33933,
|
||||||
'externalId': '46',
|
'externalId': '46',
|
||||||
'site': 'https://retailcrm.ru',
|
'site': 'https://retailcrm.pro',
|
||||||
'quantity': 0
|
'quantity': 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -4050,7 +4040,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
response = self.client.inventories({'site': 'https://retailcrm.ru'})
|
response = self.client.inventories({'site': 'https://retailcrm.pro'})
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
||||||
self.assertTrue(response.is_successful(), True)
|
self.assertTrue(response.is_successful(), True)
|
||||||
|
@ -4477,7 +4467,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
'firstName': 'John',
|
'firstName': 'John',
|
||||||
'lastName': 'Doe',
|
'lastName': 'Doe',
|
||||||
'patronymic': 'H.',
|
'patronymic': 'H.',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'code': 'ccc7'
|
'code': 'ccc7'
|
||||||
},
|
},
|
||||||
'customer': {
|
'customer': {
|
||||||
|
@ -4486,7 +4476,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
'firstName': 'John',
|
'firstName': 'John',
|
||||||
'lastName': 'Doe',
|
'lastName': 'Doe',
|
||||||
'patronymic': 'H.',
|
'patronymic': 'H.',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'code': 'ccc7',
|
'code': 'ccc7',
|
||||||
'phones': [{'number': '+71111111111'}]
|
'phones': [{'number': '+71111111111'}]
|
||||||
},
|
},
|
||||||
|
@ -4583,7 +4573,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
'id': 777,
|
'id': 777,
|
||||||
'createdAt': '2020-04-05 11:23:46',
|
'createdAt': '2020-04-05 11:23:46',
|
||||||
'active': 'true',
|
'active': 'true',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'firstName': 'yyy',
|
'firstName': 'yyy',
|
||||||
'lastName': 'xxxx',
|
'lastName': 'xxxx',
|
||||||
'status': 'free',
|
'status': 'free',
|
||||||
|
@ -4622,7 +4612,7 @@ class TestVersion5(unittest.TestCase):
|
||||||
'id': 777,
|
'id': 777,
|
||||||
'createdAt': '2020-04-05 11:23:46',
|
'createdAt': '2020-04-05 11:23:46',
|
||||||
'active': 'true',
|
'active': 'true',
|
||||||
'email': 'mail@retailcrm.ru',
|
'email': 'mail@retailcrm.pro',
|
||||||
'firstName': 'yyy',
|
'firstName': 'yyy',
|
||||||
'lastName': 'xxxx',
|
'lastName': 'xxxx',
|
||||||
'status': 'free',
|
'status': 'free',
|
||||||
|
@ -4670,11 +4660,10 @@ class TestVersion5(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/statistic/update')
|
(pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/statistic/update')
|
||||||
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
.headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')})
|
||||||
.reply(200)
|
.reply(200)
|
||||||
.headers(self.__header)
|
.headers(self.__header)
|
||||||
.json({'success': 'true'})
|
.json({'success': 'true'}))
|
||||||
)
|
|
||||||
|
|
||||||
response = self.client.statistic_update()
|
response = self.client.statistic_update()
|
||||||
pook.off()
|
pook.off()
|
||||||
|
|
Loading…
Add table
Reference in a new issue