class GetDjangoModelTest(TestCase): def setUp(self): modeldata = { 'code': 'test Code', 'description': 'test Description', 'dbEngine': 'test dbEngine', 'dbName': 'test dbName', 'dbUser': '******', 'dbPassword': '******', 'dbHost': 'test dbHost', 'dbPort': 'test dbPort' } self.testProject = Project(**modeldata) self.testProject.save() def tearDown(self): pass def test_method_with_no_dot_in_name(self): returnMessage = getDjangoModel('Project') self.assertTrue(returnMessage is not None) def test_method_with_single_dot_in_name(self): returnMessage = getDjangoModel('prototype.Project') self.assertTrue(returnMessage is not None) def test_method_with_two_dots_in_name(self): returnMessage = getDjangoModel('prototype.Project.ExtraStuffInName') self.assertTrue(returnMessage is not None) def test_method_with_user_none(self): self.assertRaises(Exception, getDjangoModel, 'SomeInvalidName')
def setUp(self): modeldata = { 'code': 'test Code', 'description': 'test Description', 'dbEngine': 'test dbEngine', 'dbName': 'test dbName', 'dbUser': '******', 'dbPassword': '******', 'dbHost': 'test dbHost', 'dbPort': 'test dbPort' } self.testProject = Project(**modeldata) self.testProject.save()
def createTestProject(): projectdata = { 'code': 'testCode', 'description': 'Project used for tests', 'dbEngine': 'MySQL', 'dbName': 'testDatabase', 'dbUser': '******', 'dbPassword': '******', 'dbHost': 'testlocalhost', 'dbPort': 'testPort' } testProject = Project(**projectdata) testProject.save() return testProject