"""
Generated by <Python Project Utils>
Visit the project in http://code.google.com/p/python-project-utils/
"""

import unittest
from test import mock
import active_record.connection
active_record.connection.ConnectionManager.instance.connector = mock.DummyConnector()
import active_record.util
import active_record.base

class ActiveRecordInitializerTestCase(unittest.TestCase):
	def test_type_error_initialize(self):
		success = False

		try:
			active_record.util.ActiveRecordInitializer.initialize(mock.DummyClass, "dummy_classes")
		except TypeError:
			success = True

		self.assertTrue(success)

	def test_initialize(self):
		class DummyClass(active_record.base.ActiveRecord):
			pass

		self.assertEqual(DummyClass.table_name, "dummy_classes")

		self.assertEqual(DummyClass.primary_key, "id")

		dummy_object = DummyClass(integer=150)

		self.assertTrue(hasattr(dummy_object, "integer"))

		self.assertEqual(dummy_object.integer, 150)
