start unittests for Type
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
129e47d0c1
commit
f515e20572
4 changed files with 61 additions and 0 deletions
0
lib/cdist/test/type/__init__.py
Normal file
0
lib/cdist/test/type/__init__.py
Normal file
0
lib/cdist/test/type/fixtures/__not_singleton/.keep
Normal file
0
lib/cdist/test/type/fixtures/__not_singleton/.keep
Normal file
0
lib/cdist/test/type/fixtures/__singleton/singleton
Normal file
0
lib/cdist/test/type/fixtures/__singleton/singleton
Normal file
61
lib/cdist/test/type/test_type.py
Normal file
61
lib/cdist/test/type/test_type.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# 2010-2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
#
|
||||||
|
# This file is part of cdist.
|
||||||
|
#
|
||||||
|
# cdist is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# cdist is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
import cdist.core
|
||||||
|
|
||||||
|
import os.path as op
|
||||||
|
my_dir = op.abspath(op.dirname(__file__))
|
||||||
|
fixtures = op.join(my_dir, 'fixtures')
|
||||||
|
|
||||||
|
|
||||||
|
class TypeTestCase(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
# FIXME: use defined set of types for testing?
|
||||||
|
# FIXME: generate object tree or use predefined?
|
||||||
|
self.temp_dir = tempfile.mkdtemp()
|
||||||
|
self.object_base_path = op.join(self.temp_dir, '')
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
shutil.rmtree(self.temp_dir)
|
||||||
|
|
||||||
|
def test_singleton_is_singleton(self):
|
||||||
|
base_path = fixtures
|
||||||
|
cdist_type = cdist.core.Type(base_path, '__singleton')
|
||||||
|
self.assertTrue(cdist_type.is_singleton)
|
||||||
|
|
||||||
|
def test_not_singleton_is_singleton(self):
|
||||||
|
base_path = fixtures
|
||||||
|
cdist_type = cdist.core.Type(base_path, '__not_singleton')
|
||||||
|
self.assertFalse(cdist_type.is_singleton)
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase)
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
tests = []
|
||||||
|
return unittest.TestSuite(map(ObjectTestCase, tests))
|
||||||
|
'''
|
Loading…
Reference in a new issue