@pytest.mark.django_db
def test_toggle_quality_check(rf, admin):
 qc_filter = dict(false_positive=False, unit__state=TRANSLATED, unit__store__translation_project__project__disabled=False)
 qc = QualityCheck.objects.filter(**qc_filter).first()
 unit = qc.unit
 data = 'mute='
 request = create_api_request(rf, method='post', user=admin, data=data, encode_as_json=False)
 response = toggle_qualitycheck(request, unit.id, qc.id)
 assert (response.status_code == 200)
 assert (QualityCheck.objects.get(id=qc.id).false_positive is True)
 request = create_api_request(rf, method='post', user=admin)
 response = toggle_qualitycheck(request, unit.id, qc.id)
 assert (response.status_code == 200)
 assert (QualityCheck.objects.get(id=qc.id).false_positive is False)

@ pytest . mark . django_db def test_toggle_quality_check ( rf , admin ) : qc_filter = dict ( false_positive = False , unit__state = TRANSLATED , unit__store__translation_project__project__disabled = False ) qc = QualityCheck . objects . filter ( ** qc_filter ) . first ( ) unit = qc . unit data = 'mute=' request = create_api_request ( rf , method = 'post' , user = admin , data = data , encode_as_json = False ) response = toggle_qualitycheck ( request , unit . id , qc . id ) assert ( response . status_code == 200 ) assert ( QualityCheck . objects . get ( id = qc . id ) . false_positive is True ) request = create_api_request ( rf , method = 'post' , user = admin ) response = toggle_qualitycheck ( request , unit . id , qc . id ) assert ( response . status_code == 200 ) assert ( QualityCheck . objects . get ( id = qc . id ) . false_positive is False )
tests the view that mutes/unmutes quality checks .