コード例 #1
0
ファイル: test_image.py プロジェクト: CCI-MOC/m2
from unittest import TestCase

from ims.common import config
config.load()

from ims.common.log import trace
from ims.database.database import Database
from ims.exception import db_exceptions


class TestInsert(TestCase):
    """ Creates a project and tests inserting images """
    @trace
    def setUp(self):
        self.db = Database()
        self.db.project.insert('project 1')

    def runTest(self):
        self.db.image.insert('image 1', 1)
        self.db.image.insert('image 2', 1, is_public=True)
        self.db.image.insert('image 3', 1, parent_id=1)
        self.db.image.insert('image 4', 1, is_snapshot=True, parent_id=1)

        images = self.db.image.fetch_images_from_project('project 1')
        self.assertTrue('image 1' in images and 'image 2' in images)

        images = self.db.image.fetch_clones_from_project('project 1')
        self.assertTrue('image 3' in [img[0] for img in images])

        snapshots = self.db.image.fetch_snapshots_from_project('project 1')
        self.assertTrue('image 4' in [snapshot[0] for snapshot in snapshots])
コード例 #2
0
 def tearDown(self):
     config.load(force=True)
コード例 #3
0
ファイル: test_project.py プロジェクト: chemistry-sourabh/ims
from unittest import TestCase

from ims.common import config
config.load()

from ims.common.log import trace
from ims.database.database import Database


class TestInsert(TestCase):
    """ Inserts Project """

    @trace
    def setUp(self):
        self.db = Database()

    def runTest(self):
        self.db.project.insert('project 1', 'network 1')

        projects = self.db.project.fetch_projects()

        self.assertEqual('project 1', projects[0][1])

    def tearDown(self):
        self.db.project.delete_with_name('project 1')
        self.db.close()


class TestDelete(TestCase):
    """ Inserts and Deletes Project """
コード例 #4
0
 def setUp(self):
     self.old_path = os.getenv('BMI_CONFIG')
     os.environ['BMI_CONFIG'] = "tests/unit/common/sample.cfg"
     config.load(force=True)
コード例 #5
0
 def runTest(self):
     os.environ['BMI_CONFIG'] = self.old_path
     config.load()
     cfg = config.get()
     self.assertEqual(cfg.tests.var1, '0')
コード例 #6
0
 def runTest(self):
     config.load(force=True)
     cfg = config.get()
     self.assertEqual(cfg.tests.var1, '0')
コード例 #7
0
 def tearDown(self):
     os.environ['BMI_CONFIG'] = self.old_path
     config.load(force=True)
コード例 #8
0
ファイル: test_config.py プロジェクト: chemistry-sourabh/ims
 def tearDown(self):
     config.load(force=True)
コード例 #9
0
 def runTest(self):
     with self.assertRaises(IOError):
         config.load(force=True)
コード例 #10
0
ファイル: test_config.py プロジェクト: chemistry-sourabh/ims
 def runTest(self):
     os.environ['BMI_CONFIG'] = self.old_path
     config.load()
     cfg = config.get()
     self.assertEqual(cfg.tests.var1, '0')
コード例 #11
0
ファイル: test_config.py プロジェクト: chemistry-sourabh/ims
 def setUp(self):
     self.old_path = os.getenv('BMI_CONFIG')
     os.environ['BMI_CONFIG'] = "tests/unit/common/sample.cfg"
     config.load(force=True)
コード例 #12
0
ファイル: test_config.py プロジェクト: chemistry-sourabh/ims
 def tearDown(self):
     os.environ['BMI_CONFIG'] = self.old_path
     config.load(force=True)
コード例 #13
0
ファイル: test_config.py プロジェクト: chemistry-sourabh/ims
 def runTest(self):
     config.load(force=True)
     cfg = config.get()
     self.assertEqual(cfg.tests.var1, '0')
コード例 #14
0
ファイル: test_config.py プロジェクト: chemistry-sourabh/ims
 def runTest(self):
     with self.assertRaises(IOError):
         config.load(force=True)