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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -