def test_get_specific_jobs_no_match(self): results = interface.get_specific_jobs(self.credential, []) expected = { 'cluster': CLUSTER["name"], 'failed': [], 'worked': [], 'error': None } self.assertEqual(results, expected)
def job_detail(request, cluster, jobid): credential = Credential.objects.get( user=request.user, cluster__name=cluster) results = interface.get_specific_jobs(credential, [jobid]) if results["error"]: e = results["error"] job = None elif results["failed"]: e = results["failed"][0][1] job = None else: job = results["worked"][0][1] e = None c = { "job": job, "cluster": cluster, "error_message": e, } return render(request, "cluster/job_detail.html", c)
def job_detail(request, cluster, jobid): credential = Credential.objects.get(user=request.user, cluster__name=cluster) results = interface.get_specific_jobs(credential, [jobid]) if results["error"]: e = results["error"] job = None elif results["failed"]: e = results["failed"][0][1] job = None else: job = results["worked"][0][1] e = None c = { "job": job, "cluster": cluster, "error_message": e, } return render(request, "cluster/job_detail.html", c)
def test_get_specific_jobs_invalid_credential(self): results = interface.get_specific_jobs(None, []) self.assertEqual(results["error"], CRED_ERROR)