コード例 #1
0
ファイル: test_queries.py プロジェクト: anderbubble/cbank
 def test_refund_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), 10,
                    datetime.now(), datetime.now())
     c = Charge(a, 5)
     r = Refund(c, -1)
     Session.add(r)
     Session.commit()
コード例 #2
0
ファイル: test_mappers.py プロジェクト: anderbubble/cbank
 def test_charge_sum_zero (self):
     allocation = Allocation(None, None, 0, datetime(2000, 1, 1), datetime(2001, 1, 1))
     allocation.project_id = "project"
     allocation.resource_id = "resource"
     Session.add(allocation)
     Session.commit()
     Session.close()
     allocation = Session.query(Allocation).one()
     assert_equal(allocation._charge_sum, 0)
コード例 #3
0
ファイル: test_queries.py プロジェクト: anderbubble/cbank
 def test_manager_projects (self):
     project_1 = Mock(['id'])
     project_1.id = "1"
     project_2 = Mock(['id'])
     project_2.id = "2"
     resource = Mock(['id'])
     resource.id = "1"
     dt = datetime(2000, 1, 1)
     Session.add(Allocation(project_1, resource, 0, dt, dt))
     Session.add(Allocation(project_2, resource, 0, dt, dt))
     assert_equal(
         get_projects(manager=User.cached("1")),
         [Project.cached("1")])
コード例 #4
0
ファイル: test_queries.py プロジェクト: anderbubble/cbank
 def test_allocations (self):
     project_1 = Mock(['id'])
     project_1.id = "1"
     project_2 = Mock(['id'])
     project_2.id = "2"
     resource = Mock(['id'])
     resource.id = "1"
     dt = datetime(2000, 1, 1)
     Session.add(Allocation(project_1, resource, 0, dt, dt))
     Session.add(Allocation(project_2, resource, 0, dt, dt))
     assert_equal(
         set(get_projects()),
         set([Project.cached("1"), Project.cached("2")]))
コード例 #5
0
ファイル: test_queries.py プロジェクト: anderbubble/cbank
 def test_charge_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), 10,
                    datetime.now(), datetime.now())
     c = Charge(a, -1)
     Session.add(c)
     Session.commit()
コード例 #6
0
ファイル: test_queries.py プロジェクト: anderbubble/cbank
 def test_hold_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), 10,
                    datetime.now(), datetime.now())
     h = Hold(a, -1)
     Session.add(h)
     Session.commit()
コード例 #7
0
ファイル: test_queries.py プロジェクト: anderbubble/cbank
 def test_allocation_amount_negative (self):
     a = Allocation(Project("1"), Resource("1"), -1,
                    datetime.now(), datetime.now())
     Session.add(a)
     Session.commit()