Which class to Mock for to bypass Springboot security in integration tests -


@springboottest(webenvironment = random_port) @activeprofiles("test") class contextloadingspec extends specification {      @autowired     testresttemplate testresttemplate      def '/ should load context'() {         when:         responseentity<object> entity = testresttemplate.getforentity('/', object.class)          then:         entity.statuscode == httpstatus.ok     }      @testconfiguration     static class config {          @bean         resttemplatebuilder resttemplatebuilder() {             return new resttemplatebuilder()             .basicauthorization('user', 'xxxxxxxx')         }     } } 

creating testconfiguration doesn't seem correct me here. credentials should in 'application.yml' , authentication call should have been mocked. please suggest better way of writing test.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -