FAQ Database Discussion Community

How to validate server's ssl certificate in python?

I have configured my server to serve only https creating a self-signed certificate. I have a client that I has to validate the server's certificate and after that will download a file from the server. How do I implement the validation in client? Is there any code example? My question...

Mockito Verify on passed sub type only sees super type

I cannot easily verify 2 individual and unique call of a sub type class to a method which takes a supertype I have a scenario that acts like this... Both B and C extend abstract type A With public class X { public String doSomething(A a){ return ""; } }...

Submit form through ajax using verify.js

How can I submit a form through AJAX while using verify.js? I want verify.js to only validate the login form: <form role="form" method="post" id="login" action="auth/login" > ...

Mockito: How to test if another class' method is called within a method of a Mock?

So I have a service class. public class OrganisationService { public List<Organisation> findAllForeignOrganisations() { // a few rows of JPQL-code that searches the database return myCriteria.getResultList(); } //...Other methods that return Lists with other types of organisations... } Then I have a class which I want to test. What I...

Verifying age on PHP

I've looked at many posts on here and I still cant figure this out. I am trying to verify that someone is older than 13 before they register for my site. This is what i have so far <?php if (is_string($_POST['birthday']) && $_POST['birthday'] != 'mm/dd/yyyy') { $dateObj = new DateTime($_POST['birthday']);...

Mockito: Verify a boolean method (or other types)

I know that you can only verify void methods. But I actually ask myself why. I recently stumbled upon an unit test where I really need to verify that a certain call has been made. To be exact, it's "newFolder.mkdirs()". The behavior of this method is pretty much "voidy"...

laravel verify shopify webhook

How can I verify my shopify webhooks in laravel? Currently I'm doing the following: //Validate secret if ( Request::header( 'X-Shopify-Hmac-Sha256' ) ) { $hmac_header = Request::header( 'X-Shopify-Hmac-Sha256' ); $data = Request::json(); $calculated_hmac = base64_encode( hash_hmac( 'sha256', $data, Config::get( 'constants.SHOPIFY_APP_SECRET' ), true ) ); if ( $hmac_header != $calculated_hmac ) {...

Is there an option in SourceTree / Git to review another persons code before pushing?

We use SourceTree for a project at work. Because all team members are inexperienced juniors, we see a lot of code that isn't exactly high quality. Therefore, we want to include a step that forces you to let your code check by another team member before you can push your...

Junit VerificationModeFactory.times() vs mockito.times()

What is the difference between VerificationModeFactory.times() and mockito.times()?