def test_can_short_circuit_max_submission(self):
     """ We should be able to short circuit if the only testcase is max_submission """
     with open(
             os.path.join(TEST_DATA_DIR,
                          'complete_config_upload_only.json')) as infile:
         autograding_config = json.load(infile)
     self.assertTrue(shipper.can_short_circuit(autograding_config))
    def test_cannot_short_circuit_single_non_file_submission_testcase(self):
        """
        If there is only one testcase, but it is non-file submission, we cannot short circuit.
        """
        with open(os.path.join(TEST_DATA_DIR,
                               'complete_config_cpp_cats.json')) as infile:
            tmp_config = json.load(infile)
        # Create a config that is a copy of cpp cats but with only one testcase.
        autograding_config = copy.deepcopy(tmp_config)
        autograding_config['testcases'] = []
        autograding_config['testcases'].append(tmp_config['testcases'][0])

        self.assertFalse(shipper.can_short_circuit(autograding_config))
 def test_cannot_short_circuit_many_testcases(self):
     """ We cannot short circuit if there are multiple testcases. """
     with open(os.path.join(TEST_DATA_DIR,
                            'complete_config_cpp_cats.json')) as infile:
         autograding_config = json.load(infile)
     self.assertFalse(shipper.can_short_circuit(autograding_config))
 def test_can_short_no_testcases(self):
     """ We should be able to short circuit configs with no testcases  """
     autograding_config = {"testcases": []}
     self.assertTrue(shipper.can_short_circuit(autograding_config))