@@ -580,16 +580,22 @@ def svc_client(mock_redis):
580
580
def svc_client_with_repo (svc_client , mock_redis ):
581
581
"""Renku service remote repository."""
582
582
remote_url = 'https://renkulab.io/gitlab/contact/integration-tests.git'
583
- headers = {'Authorization' : 'Bearer b4b4de0eda0f471ab82702bd5c367fa7' }
583
+ headers = {
584
+ 'Content-Type' : 'application/json' ,
585
+ 'accept' : 'application/json' ,
586
+ 'Authorization' : 'Bearer b4b4de0eda0f471ab82702bd5c367fa7' ,
587
+ }
584
588
585
- params = {
589
+ payload = {
586
590
'git_url' : remote_url ,
587
591
'git_username' : 'contact' ,
588
592
'git_access_token' : 'EcfPJvEqjJepyu6XyqKZ' ,
589
593
}
590
594
591
595
response = svc_client .post (
592
- '/cache/project-clone' , data = params , headers = headers
596
+ '/cache/project-clone' ,
597
+ data = json .dumps (payload ),
598
+ headers = headers ,
593
599
)
594
600
595
601
assert response
@@ -599,3 +605,84 @@ def svc_client_with_repo(svc_client, mock_redis):
599
605
assert isinstance (uuid .UUID (project_id ), uuid .UUID )
600
606
601
607
yield svc_client , headers , project_id
608
+
609
+
610
+ @pytest .fixture (
611
+ params = [
612
+ {
613
+ 'url' : '/cache/files-list' ,
614
+ 'allowed_method' : 'GET' ,
615
+ 'headers' : {
616
+ 'Content-Type' : 'application/json' ,
617
+ 'accept' : 'application/json' ,
618
+ }
619
+ },
620
+ {
621
+ 'url' : '/cache/files-upload' ,
622
+ 'allowed_method' : 'POST' ,
623
+ 'headers' : {}
624
+ },
625
+ {
626
+ 'url' : '/cache/project-clone' ,
627
+ 'allowed_method' : 'POST' ,
628
+ 'headers' : {
629
+ 'Content-Type' : 'application/json' ,
630
+ 'accept' : 'application/json' ,
631
+ }
632
+ },
633
+ {
634
+ 'url' : '/cache/project-list' ,
635
+ 'allowed_method' : 'GET' ,
636
+ 'headers' : {
637
+ 'Content-Type' : 'application/json' ,
638
+ 'accept' : 'application/json' ,
639
+ }
640
+ },
641
+ {
642
+ 'url' : '/datasets/add' ,
643
+ 'allowed_method' : 'POST' ,
644
+ 'headers' : {
645
+ 'Content-Type' : 'application/json' ,
646
+ 'accept' : 'application/json' ,
647
+ }
648
+ },
649
+ {
650
+ 'url' : '/datasets/create' ,
651
+ 'allowed_method' : 'POST' ,
652
+ 'headers' : {
653
+ 'Content-Type' : 'application/json' ,
654
+ 'accept' : 'application/json' ,
655
+ }
656
+ },
657
+ {
658
+ 'url' : '/datasets/files-list' ,
659
+ 'allowed_method' : 'GET' ,
660
+ 'headers' : {
661
+ 'Content-Type' : 'application/json' ,
662
+ 'accept' : 'application/json' ,
663
+ }
664
+ },
665
+ {
666
+ 'url' : '/datasets/list' ,
667
+ 'allowed_method' : 'GET' ,
668
+ 'headers' : {
669
+ 'Content-Type' : 'application/json' ,
670
+ 'accept' : 'application/json' ,
671
+ }
672
+ },
673
+ ]
674
+ )
675
+ def service_allowed_endpoint (request , svc_client , mock_redis ):
676
+ """Ensure allowed methods and correct headers."""
677
+ methods = {
678
+ 'GET' : svc_client .get ,
679
+ 'POST' : svc_client .post ,
680
+ 'HEAD' : svc_client .head ,
681
+ 'PUT' : svc_client .put ,
682
+ 'DELETE' : svc_client .delete ,
683
+ 'OPTIONS' : svc_client .options ,
684
+ 'TRACE' : svc_client .trace ,
685
+ 'PATCH' : svc_client .patch ,
686
+ }
687
+
688
+ yield methods , request .param , svc_client
0 commit comments