Beispiel #1
0
 def test_missing_phone_date(self):
     case = CommCareCase(actions=[
         _make_action(server_date=datetime(2001, 1, 1)),
         _make_action(server_date=datetime(2001, 1, 1), phone_date=None),
     ])
     with self.assertRaises(MissingServerDate):
         sorted(case.actions, key=_action_sort_key_function(case))
Beispiel #2
0
    def _test(self, action_tuples):
        """
        Takes in an iterable of tuples of the form: (expected_index, action).

        Calls the sort function on the actions in the order of the tuples and
        then asserts that they end up sorted in the order specified by the expected_index
        values.
        """
        case = CommCareCase(actions=[tup[1] for tup in action_tuples])
        sorted_actions = sorted(case.actions, key=_action_sort_key_function(case))
        for index, action in action_tuples:
            self.assertEqual(action, sorted_actions[index])