Commit dd0be3db authored by Pavel Kuzmenko's avatar Pavel Kuzmenko

Merge branch 'kpn/1/add_migration_on_integration_test' into 'master'

fix(integration-test): add migration on integration test

See merge request !10
parents 34dfbd90 6d748065
Pipeline #21037 passed with stages
in 1 minute and 57 seconds
# Git
.git
.gitignore
# Docker
docker-compose.yml
.docker
# Byte-compiled / optimized / DLL files
__pycache__/
*/__pycache__/
*/*/__pycache__/
*/*/*/__pycache__/
*.py[cod]
*/*.py[cod]
*/*/*.py[cod]
*/*/*/*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.mypy_cache
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Virtual environment
.env/
.venv/
venv/
# PyCharm
.idea
# Python mode for VIM
.ropeproject
*/.ropeproject
*/*/.ropeproject
*/*/*/.ropeproject
# Vim swap files
*.swp
*/*.swp
*/*/*.swp
*/*/*/*.swp
\ No newline at end of file
......@@ -5,11 +5,11 @@ WORKDIR /registry_mirror
COPY secrets /secrets
COPY config /config
COPY requirements.txt .
RUN pip install -i https://pypi-int.prozorro.sale/ -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
FROM base as base_test
COPY test-requirements.txt .
RUN pip install -r test-requirements.txt
RUN pip install --no-cache-dir -r test-requirements.txt
FROM base_test as test
COPY src/ .
......
......@@ -339,5 +339,6 @@
}
],
"documents": [
]
],
"_id": "5f74bc93a63b1d7904b5d3da"
}
-i https://pypi-int.prozorro.sale/
pyjwt~=2.0.0
aiohttp==3.6.3
iso8601
......
......@@ -7,6 +7,7 @@ from aiohttp import test_utils
from motor import motor_asyncio
from registry_mirror.main import App
from prozorro_sale.registry.migration import _migrate
from prozorro_sale.registry.model_generator import load_registry_object
REPLICA_DB = os.environ['REPLICA_DB']
......@@ -40,7 +41,9 @@ class WebSocketTest(test_utils.AioHTTPTestCase):
@test_utils.unittest_run_loop
async def test_insert_one(self):
document = deepcopy(REGISTRY_OBJECT)
document = _migrate(document, 'registry')
document = load_registry_object(document).to_native()
document.pop('_id', None)
result = await self.db.registry.insert_one(document)
await asyncio.sleep(2)
client_obj = await self.db_copy.registry.find_one({"_id": result.inserted_id})
......@@ -51,7 +54,9 @@ class WebSocketTest(test_utils.AioHTTPTestCase):
@test_utils.unittest_run_loop
async def test_update(self):
document = deepcopy(REGISTRY_OBJECT)
document = _migrate(document, 'registry')
document = load_registry_object(document).to_native()
document.pop('_id', None)
result = await self.db.registry.insert_one(document)
await asyncio.sleep(2)
client_obj = await self.db_copy.registry.find_one({"_id": result.inserted_id})
......@@ -69,7 +74,9 @@ class WebSocketTest(test_utils.AioHTTPTestCase):
@test_utils.unittest_run_loop
async def test_update_with_none(self):
document = deepcopy(REGISTRY_OBJECT)
document = _migrate(document, 'registry')
document = load_registry_object(document).to_native()
document.pop('_id', None)
result = await self.db.registry.insert_one(document)
await asyncio.sleep(2)
client_obj = await self.db_copy.registry.find_one({"_id": result.inserted_id})
......@@ -84,7 +91,9 @@ class WebSocketTest(test_utils.AioHTTPTestCase):
@test_utils.unittest_run_loop
async def test_replace(self):
document = deepcopy(REGISTRY_OBJECT)
document = _migrate(document, 'registry')
document = load_registry_object(document).to_native()
document.pop('_id', None)
result = await self.db.registry.insert_one(document)
await asyncio.sleep(2)
client_obj = await self.db_copy.registry.find_one({"_id": result.inserted_id})
......@@ -100,7 +109,9 @@ class WebSocketTest(test_utils.AioHTTPTestCase):
@test_utils.unittest_run_loop
async def test_update_upsert(self):
document = deepcopy(REGISTRY_OBJECT)
document = _migrate(document, 'registry')
document = load_registry_object(document).to_native()
document.pop('_id', None)
result = await self.db.registry.insert_one(document)
await asyncio.sleep(2)
client_obj = await self.db_copy.registry.find_one({"_id": result.inserted_id})
......@@ -119,7 +130,9 @@ class WebSocketTest(test_utils.AioHTTPTestCase):
@test_utils.unittest_run_loop
async def test_delete(self):
document = deepcopy(REGISTRY_OBJECT)
document = _migrate(document, 'registry')
document = load_registry_object(document).to_native()
document.pop('_id', None)
result = await self.db.registry.insert_one(document)
await asyncio.sleep(2)
client_obj = await self.db_copy.registry.find_one({"_id": result.inserted_id})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment