IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Ver código fonte

Add test_command_image_untag().

master
Stanislaw Adaszewski 4 anos atrás
pai
commit
5095d85d59
1 arquivos alterados com 22 adições e 2 exclusões
  1. +22
    -2
      tests/test_image.py

+ 22
- 2
tests/test_image.py Ver arquivo

@@ -3,14 +3,16 @@ from focker.image import validate_spec, \
build_squeeze, \
build, \
command_image_build, \
command_image_tag
command_image_tag, \
command_image_untag
import subprocess
from tempfile import TemporaryDirectory
import focker.image
import os
from focker.zfs import zfs_find, \
zfs_mountpoint, \
zfs_exists_snapshot_sha256
zfs_exists_snapshot_sha256, \
zfs_parse_output
from focker.misc import focker_unlock
import yaml
@@ -142,3 +144,21 @@ def test_command_image_tag():
zfs_find(t, focker_type='image')
with pytest.raises(ValueError):
zfs_find('test-command-image-tag', focker_type='image')
def test_command_image_untag():
focker_unlock()
subprocess.check_output(['focker', 'image', 'remove', '--force', '-R', 'test-command-image-untag'])
subprocess.check_output(['focker', 'bootstrap', '--dry-run', '-t', 'test-command-image-untag', 'test-command-image-untag-1', 'test-command-image-untag-2'])
name, sha256 = zfs_find('test-command-image-untag', focker_type='image')
args = lambda: 0
args.tags = ['test-command-image-untag-1', 'test-command-image-untag-2']
command_image_untag(args)
tags = zfs_parse_output(['zfs', 'get', '-H', 'focker:tags', name])
tags = tags[0][2].split(',')
assert tags == ['test-command-image-untag']
with pytest.raises(ValueError):
zfs_find('test-command-image-untag-1', focker_type='image')
with pytest.raises(ValueError):
zfs_find('test-command-image-untag-2', focker_type='image')
subprocess.check_output(['focker', 'image', 'remove', 'test-command-image-untag'])

Carregando…
Cancelar
Salvar