def setUp(self): """create test data """ super(RoleViewsUnitTestCase, self).setUp() from stalker import db, Role self.test_role1 = Role(name='Test Role 1', created_by=self.admin) db.DBSession.add(self.test_role1) self.test_role2 = Role(name='Test Role 2', created_by=self.admin) db.DBSession.add(self.test_role2) self.test_role3 = Role(name='Test Role 3', created_by=self.admin) db.DBSession.add(self.test_role3) db.DBSession.commit()
def setUp(self): """set the test up """ super(ProjectUserTestDBCase, self).setUp() from stalker import Repository self.test_repo = Repository(name='Test Repo') from stalker.db.session import DBSession DBSession.add(self.test_repo) DBSession.commit() from stalker import User self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') DBSession.add(self.test_user1) from stalker import Project self.test_project = Project( name='Test Project 1', code='TP1', repositories=[self.test_repo], ) DBSession.add(self.test_project) from stalker import Role self.test_role = Role(name='Test User') DBSession.add(self.test_role) DBSession.commit()
def test_role_class_generic(): """testing of creation of a Role instance """ from stalker import Role r = Role(name='Lead') assert isinstance(r, Role) assert r.name == 'Lead'
def setUp(self): """set the test up """ from stalker import Status, StatusList, Repository self.test_repo = Repository(name='Test Repo') self.status_new = Status(name='New', code='NEW') self.status_wip = Status(name='Work In Progress', code='WIP') self.status_cmpl = Status(name='Completed', code='CMPL') self.project_statuses = StatusList( name='Project Status List', statuses=[self.status_new, self.status_wip, self.status_cmpl], target_entity_type='Project') from stalker import User self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') from stalker import Project self.test_project = Project(name='Test Project 1', code='TP1', repositories=[self.test_repo], status_list=self.project_statuses) from stalker import Role self.test_role = Role(name='Test User')
def setUp(self): """set the test up """ super(ProjectClientTestDBCase, self).setUp() from stalker import Status, Repository self.test_repo = Repository(name='Test Repo') self.status_new = Status(name='New', code='NEW') self.status_wip = Status(name='Work In Progress', code='WIP') self.status_cmpl = Status(name='Completed', code='CMPL') from stalker import User self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') from stalker import Client self.test_client = Client(name='Test Client') from stalker import Project self.test_project = Project( name='Test Project 1', code='TP1', repositories=[self.test_repo], ) from stalker import Role self.test_role = Role(name='Test Client')
def setUp(self): """create the test data """ super(DepartmentViewsFunctionalTestCase, self).setUp() from stalker import db, User self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******', created_by=self.admin) db.DBSession.add(self.test_user1) self.test_user2 = User(name='Test User 2', login='******', email='*****@*****.**', password='******', created_by=self.admin) db.DBSession.add(self.test_user2) self.test_user3 = User(name='Test User 3', login='******', email='*****@*****.**', password='******', created_by=self.admin) db.DBSession.add(self.test_user3) from stalker import Department self.test_department1 = Department(name='Test Department 1', created_by=self.admin) db.DBSession.add(self.test_department1) self.test_department2 = Department(name='Test Department 2', created_by=self.admin) db.DBSession.add(self.test_department2) # create a couple of roles from stalker import Role self.test_role1 = Role(name='Test Role 1', created_by=self.admin) self.test_role2 = Role(name='Test Role 2', created_by=self.admin) self.test_role3 = Role(name='Test Role 3', created_by=self.admin) db.DBSession.add_all( [self.test_role1, self.test_role2, self.test_role3]) db.DBSession.commit()
def setUp(self): """set the test up """ super(ProjectUserTestCase, self).setUp() from stalker import Status, StatusList, Repository self.test_repo = Repository(name='Test Repo') from stalker import db db.DBSession.add(self.test_repo) db.DBSession.commit() self.status_new = Status.query.filter_by(code='NEW').first() self.status_wip = Status.query.filter_by(code='WIP').first() self.status_cmpl = Status.query.filter_by(code='CMPL').first() self.project_statuses = StatusList( name='Project Status List', statuses=[self.status_new, self.status_wip, self.status_cmpl], target_entity_type='Project') db.DBSession.add(self.project_statuses) from stalker import User self.test_user1 = User(name='Test User 1', login='******', email='*****@*****.**', password='******') db.DBSession.add(self.test_user1) from stalker import Project self.test_project = Project(name='Test Project 1', code='TP1', repositories=[self.test_repo], status_list=self.project_statuses) db.DBSession.add(self.test_project) from stalker import Role self.test_role = Role(name='Test User') db.DBSession.add(self.test_role) db.DBSession.commit()
def test_role_class_generic(self): """testing of creation of a Role instance """ r = Role(name='Lead') self.assertTrue(isinstance(r, Role)) self.assertEqual(r.name, 'Lead')