import nose.tools           as nose
import biobox_cli.container as ctn

import helper as hlpr

def test_get_client():
    ctn.client()

def test_checking_a_local_available_image():
    nose.assert_equal(ctn.is_image_available_locally("python"), True)

def test_checking_an_local_available_image_with_tag():
    nose.assert_equal(ctn.is_image_available_locally("python:2.7"), True)

def test_checking_a_locally_non_existent_image():
    nose.assert_equal(ctn.is_image_available_locally("biobox/unknown"), False)

def test_checking_an_available_image():
    nose.assert_equal(ctn.is_image_available("python"), True)

def test_checking_an_available_image_with_tag():
    nose.assert_equal(ctn.is_image_available("python:2.7"), True)

def test_create_volume_string_with_relative_dir():
    expected = "{}/tmp:/tmp:ro".format(hlpr.project_root())
    nose.assert_equal(ctn.volume_string("tmp", "/tmp"), expected)

def test_create_volume_string_with_absolute_dir():
    expected = "/tmp:/tmp:ro"
    nose.assert_equal(ctn.volume_string("/tmp", "/tmp"), expected)

def test_create_output_volume_string():
    expected = "/tmp:/bbx/output:rw"
    nose.assert_equal(ctn.output_directory_volume_string("/tmp"), expected)

def test_create_output_volume_string():
    expected = "/tmp:/bbx/input:ro"
    nose.assert_equal(ctn.biobox_file_volume_string("/tmp"), expected)

def test_create_container_with_no_volumes():
    container = ctn.create("bioboxes/velvet", "default")
    attr = ctn.client().inspect_container(container)
    nose.assert_equal(attr["Volumes"], {})
    hlpr.remove_container(container)

def test_create_container_with_volumes():
    container = ctn.create("bioboxes/velvet", "default", ["/host:/cont:ro"])
    attr = ctn.client().inspect_container(container)
    nose.assert_in("/host", attr["Volumes"])
    hlpr.remove_container(container)

import nose.tools           as nose
import biobox_cli.container as ctn

import helper as hlpr

def test_get_client():
    ctn.client()

def test_checking_a_local_available_image():
    nose.assert_equal(ctn.is_image_available_locally("python"), True)

def test_checking_an_local_available_image_with_tag():
    nose.assert_equal(ctn.is_image_available_locally("python:2.7"), True)

def test_checking_a_locally_non_existent_image():
    nose.assert_equal(ctn.is_image_available_locally("biobox/unknown"), False)

def test_checking_an_available_image():
    nose.assert_equal(ctn.is_image_available("python"), True)

def test_checking_an_available_image_with_tag():
    nose.assert_equal(ctn.is_image_available("python:2.7"), True)

def test_create_volume_string_with_relative_dir():
    expected = "{}/tmp:/tmp:ro".format(hlpr.project_root())
    nose.assert_equal(ctn.volume_string("tmp", "/tmp"), expected)

def test_create_volume_string_with_absolute_dir():
    expected = "/tmp:/tmp:ro"
    nose.assert_equal(ctn.volume_string("/tmp", "/tmp"), expected)

def test_create_output_volume_string():
    expected = "/tmp:/bbx/output:rw"
    nose.assert_equal(ctn.output_directory_volume_string("/tmp"), expected)

def test_create_output_volume_string():
    expected = "/tmp:/bbx/input:ro"
    nose.assert_equal(ctn.biobox_file_volume_string("/tmp"), expected)

def test_create_container_with_no_volumes():
    container = ctn.create("bioboxes/velvet", "default")
    attr = ctn.client().inspect_container(container)
    nose.assert_equal(attr["Config"]["Volumes"], None)
    hlpr.remove_container(container)

def test_create_container_with_volumes():
    container = ctn.create("bioboxes/velvet", "default", ["/host:/cont:ro"])
    attr = ctn.client().inspect_container(container)
    nose.assert_in("/host", attr["Config"]["Volumes"])
    hlpr.remove_container(container)

fix unit tests