Example #1
0
 def test_upstream_ids (self):
     start = datetime(2000, 1, 1)
     end = start + timedelta(weeks=1)
     a1 = Allocation(Project("-1"), Resource.fetch("-1"), 0, start, end)
     h1 = Hold(a1, 0)
     h1.datetime = datetime(2000, 1, 1)
     Session.add(h1)
     Session.flush()
     stdout, stderr = capture(lambda:
         print_holds_list([h1]))
     assert_equal_multiline(stdout.getvalue(), dedent("""\
         1      2000-01-01 -1       -1                        0.0
         """))
Example #2
0
 def test_hold (self):
     user1 = User.fetch("user1")
     project1 = Project.fetch("project1")
     res1 = Resource.fetch("res1")
     allocation1 = Allocation(project1, res1, 0,
         datetime(2000, 1, 1), datetime(2001, 1, 1))
     hold = Hold(allocation1, 0)
     hold.datetime = datetime(2000, 1, 1)
     Session.add(hold)
     Session.flush()
     stdout, stderr = capture(lambda:
         print_holds([hold]))
     assert_equal_multiline(stdout.getvalue(), dedent("""\
         Hold 1 -- 0.0
          * Datetime: 2000-01-01 00:00:00
          * Active: True
          * Allocation: 1
          * Project: project1
          * Resource: res1
          * Comment: 
          * Job: None
         """))