Commit 2792f782 authored by Samuel GAIST's avatar Samuel GAIST

[test][core] Added test to push several versions

parent e0591a9e
......@@ -42,6 +42,7 @@ import os
import nose.tools
import click
import shutil
from collections import namedtuple
from click.testing import CliRunner
......@@ -71,6 +72,9 @@ else:
# Make skip on disconnected a decorator, this will make tests easier to read and write
skip_disconnected = skipif(disconnected, "missing test platform (%s)" % platform)
# Used for making direct calls
MockConfig = namedtuple("MockConfig", ["platform", "user", "token"])
class BaseTest:
asset_type = None
......@@ -281,6 +285,42 @@ class AssetRemoteTest(AssetBaseTest):
exit_code, output = self.call("status", prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, output)
@slow
@skip_disconnected
def test_push_different_versions(self):
with common.Selector(tmp_prefix) as selector:
if not selector.has_versions(self.asset_type):
raise nose.SkipTest(
"{} does not support versions".format(self.asset_type)
)
asset_name = self.object_map["create"]
self.create(asset_name)
number_of_versions = 5
version_pos = asset_name.rindex("/") + 1
original_name = asset_name[:version_pos]
original_version = int(asset_name[version_pos:])
for i in range(number_of_versions):
asset_name = original_name + str(original_version + i)
exit_code, outputs = self.call("version", asset_name, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, outputs)
asset_name = original_name + str(original_version + number_of_versions)
exit_code, output = self.call("push", asset_name, prefix=tmp_prefix)
nose.tools.eq_(exit_code, 0, output)
config = MockConfig(self.live_server_url, user, token)
with common.make_webapi(config) as webapi:
asset_list = common.retrieve_remote_list(webapi, self.asset_type, ["name"])
aoi_list = [
asset for asset in asset_list if asset["name"].startswith(original_name)
]
nose.tools.assert_equal(len(aoi_list), number_of_versions + 1)
@slow
@skip_disconnected
def test_push_and_delete(self):
......
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