def test_parent_child_relation(self): """testing the parent/child relation of Budgets """ b1 = Budget(**self.kwargs) b2 = Budget(**self.kwargs) b2.parent = b1 self.assertEqual(b1.children, [b2])
def test_budget_attribute_is_working_properly(self): """testing if the budget attribute value can correctly be changed """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10.0) new_budget = Budget(name='Test Budget', project=self.test_project) self.assertNotEqual(entry.budget, new_budget) entry.budget = new_budget self.assertEqual(entry.budget, new_budget)
def test_budget_attribute_is_working_properly(self): """testing if the budget attribute value can correctly be changed """ entry = BudgetEntry(budget=self.test_budget, good=self.test_good, amount=10.0) new_budget = Budget(name='Test Budget', project=self.test_project, status_list=self.budget_status_list) assert entry.budget != new_budget entry.budget = new_budget assert entry.budget == new_budget
def test_entries_attribute_is_working_properly(self): """testing if the entries attribute is working properly """ from stalker import BudgetEntry some_other_budget = Budget(name='Test Budget', project=self.test_project) entry1 = BudgetEntry( budget=some_other_budget, good=self.test_good, ) entry2 = BudgetEntry( budget=some_other_budget, good=self.test_good, ) self.test_budget.entries = [entry1, entry2] self.assertEqual(self.test_budget.entries, [entry1, entry2])
def setUp(self): """run once """ defaults.timing_resolution = datetime.timedelta(hours=1) # create a new session db.setup({ 'sqlalchemy.url': 'sqlite://', 'sqlalchemy.echo': False }) db.init() self.status_wfd = Status.query.filter_by(code="WFD").first() self.status_rts = Status.query.filter_by(code="RTS").first() self.status_wip = Status.query.filter_by(code="WIP").first() self.status_prev = Status.query.filter_by(code="PREV").first() self.status_hrev = Status.query.filter_by(code="HREV").first() self.status_drev = Status.query.filter_by(code="DREV").first() self.status_oh = Status.query.filter_by(code="OH").first() self.status_stop = Status.query.filter_by(code="STOP").first() self.status_cmpl = Status.query.filter_by(code="CMPL").first() self.status_new = Status.query.filter_by(code='NEW').first() self.status_app = Status.query.filter_by(code='APP').first() self.budget_status_list = StatusList( name='Budget Statuses', target_entity_type='Budget', statuses=[self.status_new, self.status_prev, self.status_app] ) db.DBSession.add(self.budget_status_list) self.task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type=Project, ) self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type=Project, ) self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type=Repository, ) self.test_repository = Repository( name="Test Repository", type=self.test_repository_type, linux_path=tempfile.mkdtemp(), windows_path=tempfile.mkdtemp(), osx_path=tempfile.mkdtemp() ) self.test_user1 = User( name="User1", login="******", email="*****@*****.**", password="******" ) self.test_user2 = User( name="User2", login="******", email="*****@*****.**", password="******" ) self.test_user3 = User( name="User3", login="******", email="*****@*****.**", password="******" ) self.test_user4 = User( name="User4", login="******", email="*****@*****.**", password="******" ) self.test_user5 = User( name="User5", login="******", email="*****@*****.**", password="******" ) self.test_project = Project( name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository ) self.kwargs = { 'project': self.test_project, 'name': 'Test Budget 1' } self.test_budget = Budget(**self.kwargs) self.test_good = Good( name='Some Good', cost=100, msrp=120, unit='$' )
def setUp(self): """run once """ from stalker import defaults import datetime defaults.timing_resolution = datetime.timedelta(hours=1) # create a new session from stalker import db db.setup({'sqlalchemy.url': 'sqlite://', 'sqlalchemy.echo': False}) db.init() from stalker import Status self.status_wfd = Status.query.filter_by(code="WFD").first() self.status_rts = Status.query.filter_by(code="RTS").first() self.status_wip = Status.query.filter_by(code="WIP").first() self.status_prev = Status.query.filter_by(code="PREV").first() self.status_hrev = Status.query.filter_by(code="HREV").first() self.status_drev = Status.query.filter_by(code="DREV").first() self.status_oh = Status.query.filter_by(code="OH").first() self.status_stop = Status.query.filter_by(code="STOP").first() self.status_cmpl = Status.query.filter_by(code="CMPL").first() self.status_new = Status.query.filter_by(code='NEW').first() self.status_app = Status.query.filter_by(code='APP').first() from stalker import StatusList self.budget_status_list = StatusList( name='Budget Statuses', target_entity_type='Budget', statuses=[self.status_new, self.status_prev, self.status_app]) db.DBSession.add(self.budget_status_list) self.task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() from stalker import Project self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type=Project, ) from stalker import Type self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type=Project, ) from stalker import Repository self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type=Repository, ) self.test_repository = Repository( name="Test Repository", type=self.test_repository_type, ) from stalker import User self.test_user1 = User(name="User1", login="******", email="*****@*****.**", password="******") self.test_user2 = User(name="User2", login="******", email="*****@*****.**", password="******") self.test_user3 = User(name="User3", login="******", email="*****@*****.**", password="******") self.test_user4 = User(name="User4", login="******", email="*****@*****.**", password="******") self.test_user5 = User(name="User5", login="******", email="*****@*****.**", password="******") from stalker import Client self.test_client = Client(name='Test Client', ) self.test_project = Project(name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository, clients=[self.test_client]) from stalker import Budget self.test_budget = Budget( project=self.test_project, name='Test Budget 1', ) from stalker import Invoice self.test_invoice = Invoice(budget=self.test_budget, client=self.test_client, amount=1500, unit='TRY')
def setUp(self): """run once """ super(InvoiceTestCase, self).setUp() from stalker import Status self.status_wfd = Status.query.filter_by(code="WFD").first() self.status_rts = Status.query.filter_by(code="RTS").first() self.status_wip = Status.query.filter_by(code="WIP").first() self.status_prev = Status.query.filter_by(code="PREV").first() self.status_hrev = Status.query.filter_by(code="HREV").first() self.status_drev = Status.query.filter_by(code="DREV").first() self.status_oh = Status.query.filter_by(code="OH").first() self.status_stop = Status.query.filter_by(code="STOP").first() self.status_cmpl = Status.query.filter_by(code="CMPL").first() self.status_new = Status.query.filter_by(code='NEW').first() self.status_app = Status.query.filter_by(code='APP').first() from stalker import db, StatusList self.budget_status_list = StatusList( name='Budget Statuses', target_entity_type='Budget', statuses=[self.status_new, self.status_prev, self.status_app]) db.DBSession.add(self.budget_status_list) self.task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() from stalker import Project self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type=Project, ) db.DBSession.add(self.test_project_status_list) from stalker import Type self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type=Project, ) db.DBSession.add(self.test_movie_project_type) from stalker import Repository self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type=Repository, ) db.DBSession.add(self.test_repository_type) self.test_repository = Repository( name="Test Repository", type=self.test_repository_type, ) db.DBSession.add(self.test_repository) from stalker import User self.test_user1 = User(name="User1", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user1) self.test_user2 = User(name="User2", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user2) self.test_user3 = User(name="User3", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user3) self.test_user4 = User(name="User4", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user4) self.test_user5 = User(name="User5", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user5) from stalker import Client self.test_client = Client(name='Test Client', ) db.DBSession.add(self.test_client) self.test_project = Project(name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository, clients=[self.test_client]) db.DBSession.add(self.test_project) from stalker import Budget self.test_budget = Budget( project=self.test_project, name='Test Budget 1', ) db.DBSession.add(self.test_budget) db.DBSession.commit()
def setUp(self): """run once """ super(BudgetTestBase, self).setUp() from stalker import db, Status self.status_wfd = Status.query.filter_by(code="WFD").first() self.status_rts = Status.query.filter_by(code="RTS").first() self.status_wip = Status.query.filter_by(code="WIP").first() self.status_prev = Status.query.filter_by(code="PREV").first() self.status_hrev = Status.query.filter_by(code="HREV").first() self.status_drev = Status.query.filter_by(code="DREV").first() self.status_oh = Status.query.filter_by(code="OH").first() self.status_stop = Status.query.filter_by(code="STOP").first() self.status_cmpl = Status.query.filter_by(code="CMPL").first() self.status_new = Status.query.filter_by(code='NEW').first() self.status_app = Status.query.filter_by(code='APP').first() from stalker import StatusList self.budget_status_list = StatusList( name='Budget Statuses', target_entity_type='Budget', statuses=[self.status_new, self.status_prev, self.status_app]) db.DBSession.add(self.budget_status_list) self.task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type='Project', ) db.DBSession.add(self.test_project_status_list) from stalker import Type self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type='Project', ) db.DBSession.add(self.test_movie_project_type) self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type='Repository', ) db.DBSession.add(self.test_repository_type) from stalker import Repository self.test_repository = Repository(name="Test Repository", type=self.test_repository_type, linux_path='/mnt/T/', windows_path='T:/', osx_path='/Volumes/T/') db.DBSession.add(self.test_repository) from stalker import User self.test_user1 = User(name="User1", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user1) self.test_user2 = User(name="User2", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user2) self.test_user3 = User(name="User3", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user3) self.test_user4 = User(name="User4", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user4) self.test_user5 = User(name="User5", login="******", email="*****@*****.**", password="******") db.DBSession.add(self.test_user5) from stalker import Project self.test_project = Project(name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository) db.DBSession.add(self.test_project) self.kwargs = {'project': self.test_project, 'name': 'Test Budget 1'} self.test_budget = Budget(**self.kwargs) db.DBSession.add(self.test_budget) from stalker import Good self.test_good = Good(name='Some Good', cost=100, msrp=120, unit='$') db.DBSession.add(self.test_good) db.DBSession.commit()
def setUp(self): """run once """ super(BudgetTestBase, self).setUp() from stalker import Status self.status_wfd = Status(name='Waiting For Dependency', code="WFD") self.status_rts = Status(name='Ready To Start', code="RTS") self.status_wip = Status(name='Work In Progress', code="WIP") self.status_prev = Status(name='Pending Review', code="PREV") self.status_hrev = Status(name='Has Revision', code="HREV") self.status_drev = Status(name='Dependency Has Revision', code="DREV") self.status_oh = Status(name='On Hold', code="OH") self.status_stop = Status(name='Stopped', code="STOP") self.status_cmpl = Status(name='Completed', code="CMPL") self.status_new = Status(name='New', code='NEW') self.status_app = Status(name='Approved', code='APP') from stalker import StatusList self.budget_status_list = StatusList( name='Budget Statuses', target_entity_type='Budget', statuses=[self.status_new, self.status_prev, self.status_app]) self.task_status_list = StatusList(statuses=[ self.status_wfd, self.status_rts, self.status_wip, self.status_prev, self.status_hrev, self.status_drev, self.status_cmpl ], target_entity_type='Task') self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type='Project', ) from stalker import Type self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type='Project', ) self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type='Repository', ) from stalker import Repository self.test_repository = Repository(name="Test Repository", type=self.test_repository_type, linux_path='/mnt/T/', windows_path='T:/', osx_path='/Volumes/T/') from stalker import User self.test_user1 = User(name="User1", login="******", email="*****@*****.**", password="******") self.test_user2 = User(name="User2", login="******", email="*****@*****.**", password="******") self.test_user3 = User(name="User3", login="******", email="*****@*****.**", password="******") self.test_user4 = User(name="User4", login="******", email="*****@*****.**", password="******") self.test_user5 = User(name="User5", login="******", email="*****@*****.**", password="******") from stalker import Project self.test_project = Project( name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository, ) self.kwargs = { 'project': self.test_project, 'name': 'Test Budget 1', 'status_list': self.budget_status_list } self.test_budget = Budget(**self.kwargs) from stalker import Good self.test_good = Good(name='Some Good', cost=100, msrp=120, unit='$')
def setUp(self): """run once """ super(PaymentTestCase, self).setUp() from stalker import Status self.status_new = Status(name='Mew', code='NEW') self.status_wfd = Status(name='Waiting For Dependency', code='WFD') self.status_rts = Status(name='Ready To Start', code='RTS') self.status_wip = Status(name='Work In Progress', code='WIP') self.status_prev = Status(name='Pending Review', code='PREV') self.status_hrev = Status(name='Has Revision', code='HREV') self.status_drev = Status(name='Dependency Has Revision', code='DREV') self.status_oh = Status(name='On Hold', code='OH') self.status_stop = Status(name='Stopped', code='STOP') self.status_cmpl = Status(name='Completed', code='CMPL') self.status_new = Status(name='New', code='NEW') self.status_app = Status(name='Approved', code='APP') from stalker import StatusList self.budget_status_list = StatusList( name='Budget Statuses', target_entity_type='Budget', statuses=[self.status_new, self.status_prev, self.status_app]) self.task_status_list = StatusList( name='Task Statses', statuses=[ self.status_wfd, self.status_rts, self.status_wip, self.status_prev, self.status_hrev, self.status_drev, self.status_oh, self.status_stop, self.status_cmpl ], target_entity_type='Task') from stalker import Project self.test_project_status_list = StatusList( name="Project Statuses", statuses=[self.status_wip, self.status_prev, self.status_cmpl], target_entity_type=Project, ) from stalker import Type self.test_movie_project_type = Type( name="Movie Project", code='movie', target_entity_type=Project, ) from stalker import Repository self.test_repository_type = Type( name="Test Repository Type", code='test', target_entity_type=Repository, ) self.test_repository = Repository( name="Test Repository", type=self.test_repository_type, ) from stalker import User self.test_user1 = User(name="User1", login="******", email="*****@*****.**", password="******") self.test_user2 = User(name="User2", login="******", email="*****@*****.**", password="******") self.test_user3 = User(name="User3", login="******", email="*****@*****.**", password="******") self.test_user4 = User(name="User4", login="******", email="*****@*****.**", password="******") self.test_user5 = User(name="User5", login="******", email="*****@*****.**", password="******") from stalker import Client self.test_client = Client(name='Test Client', ) self.test_project = Project(name="Test Project1", code='tp1', type=self.test_movie_project_type, status_list=self.test_project_status_list, repository=self.test_repository, clients=[self.test_client]) from stalker import Budget self.test_budget = Budget(project=self.test_project, name='Test Budget 1', status_list=self.budget_status_list) from stalker import Invoice self.test_invoice = Invoice(budget=self.test_budget, client=self.test_client, amount=1500, unit='TRY')