integration-testing

How can I make integration tests with google cloud bigquery

十年热恋 提交于 2019-12-07 00:19:35
问题 We are in the processing of migrating from apache hbase to bigquery. Currently we have end to end tests (using cucumbers) that work with a docker container running hbase. There don't seem to be any bigquery docker containers or emulators (https://cloud.google.com/sdk/gcloud/reference/beta/emulators/) How would we be able to create end to end tests for an application working with bigquery? 回答1: Currently there is not any kind of BigQuery local emulator or anything similar to that. As pointed

Rails rspec and omniauth (integration testing)

时光怂恿深爱的人放手 提交于 2019-12-06 23:39:39
问题 My Rails 3.2 app uses OmniAuth and Devise to sign in with Twitter. The authentication system works fine. I would like to write an integration test in rspec to make sure everything works. Using the information in the wiki, I've written the following, but I know I'm missing things. Under test.rb in config/environments, I have the following lines OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:twitter] = {:provider => 'twitter', :uid => '123545'} My rspec test looks like this:

What's the proper way to test token-based auth using APIRequestFactory?

扶醉桌前 提交于 2019-12-06 21:47:21
问题 The query to my endpoint works fine (as long as I pass it a valid token), it returns the json representation of my response data. The code in the service api that calls my endpoint, passing an auth token in the header: headers = {'content-type': 'application/json', 'Authorization': 'Token {}'.format(myToken)} url = 'http://localhost:8000/my_endpoint/' r = session.get(url=url, params=params, headers=headers) In views.py, I have a method decorator that wraps the dispatch method on the view

How to mock Amazon S3 in an integration test

此生再无相见时 提交于 2019-12-06 17:04:22
问题 I'm trying to get an "walking skeleton" of my app up that will use S3 for persistence. I would like to use a fake S3 service so each developer's desktop can read/write at will. I thought mocks3 would be perfect, as I could get a jetty server up in my jUnit tests. The problem is that mocks3 doesn't allow any writes . Not even to set it up as far as I can tell. So how do others do this? 回答1: Tornado, a python web framework, has an example app that is just what you're looking for. https://github

How to test a client of a WCF service

烂漫一生 提交于 2019-12-06 16:52:39
I have a WCF service that exposes 1 method GetNextObjectInList(int id) which hits a DB. The WCF service works, more or less, like this: public class MyService : IDisposable { public MyService() { this.IntializeDBConnection(); } public int GetNextObjectInList(int id) { /* uses DB connection */ } /* Dispose releases DB connection */ } This makes the client code relatively simple: public void UseNextElementInList() { IMyService svc = new MyServiceClient(); int nextID = svc.GetNextObjectInList(this.ID); /* use object */ } I've written unit tests to test the WCF services objects, but I'd like to

Integration test for image download java

点点圈 提交于 2019-12-06 15:59:59
问题 I'm trying to write an integration test to see if a file is downloaded correctly from a url. I'm not sure how to test this because I expect to get the file in byte[] but I not really sure about the image that I'm comparing it to. I thought about downloading the file manually and then convert it to bytes and take the result and paste it in the code as the expected value and than compare it to the result i get. If you have a better idea I would be glad to hear it. Thanks:) 回答1: Comparing the

How can I specify the path to JUnit results from integration tests?

瘦欲@ 提交于 2019-12-06 13:47:19
问题 So I know there is sonar.junit.reportsPath that is read by the Java plugin and takes a single directory of XML files to parse. But what if I do not have one directory of test results, but two, specifically one for unit tests and one for integration tests? The more recent versions of Sonarqube gained some support for reporting coverage of these different test results via sonar.jacoco.reportPath and sonar.jacoco.itReportPath . I also find some references on the internet about sonar.junit

How to do ASP.NET Web API integration tests with custom authentication and in-memory hosting

时间秒杀一切 提交于 2019-12-06 13:38:42
A similar question has been answered here but the answer doesn't seem to work in my case. I want to test the authentication/authorization process in my Web Api which is using a JWT authentication. My authentication is handled through a custom MessageHandler that I add to my HttpConfiguration . Authorization in handled by a simple [Authorize] Attribute on Controller/Methods I want to restrict access to. I'm setting the principal I've extracted from my token this way during authentication (in my custom MessageHandler ): Thread.CurrentPrincipal = principal; if (HttpContext.Current != null) {

How to add FormsAuthentication cookie to HttpClient HttpRequestMessage

守給你的承諾、 提交于 2019-12-06 12:39:23
I am trying to authenticate inside integration test by calling FormsAuthentication.SetAuthCookie("someUser", false); After that I do need to call WebAPI and not receive unauthorized exception because I have authorized attribute applied. I am using this code to create auth cookie : var cookie = FormsAuthentication.GetAuthCookie(name, rememberMe); var ticket = FormsAuthentication.Decrypt(cookie.Value); var newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, userData.ToJson(), ticket.CookiePath); var encTicket =

How to obtain JNDI data source for JPA/JTA DAO integration test?

假装没事ソ 提交于 2019-12-06 11:58:43
问题 I have a JPA application that has specified JTA transactions in persistence.xml. For whatever reason, I have found that when using JTA, you MUST specify a JNDI data source within persistence.xml as well. This is fine, unless you are trying to go integration testing outside a container and JNDI is not available. My questions are: a) is there anyway to inject a jdbc datasource into my JTA transaction manager? b) if not, how do a handle a JNDI lookup during integration testing? Edit: The error I