webtest

Symfony / Doctrine UnitTests with SQLite memory DB

喜夏-厌秋 提交于 2019-12-03 12:58:47
I'm still working on PHP unit tests for testing my symfony2 controllers. My test classes are derivations of WebTestCase and the tests are doing GET or POST requests do check if everything works fine. I want to test all underlying layers, but I don't want to mess up my database with the tests. I don't want to use mock ups, but an in-memory SQLite db, where I can set up a test scenario to check all modifications. I found a lot of hints how to do this with doctrine 1.x, but they don't work any more. So I want something like this: class BlahblahTest extends WebTestCase { public function testXXXYYY

Disabling @login_required while unit-testing flask with flask-login

二次信任 提交于 2019-12-03 12:55:53
I am unit testing my flask app which uses the flask-login extension. I am setting up all my tests like this using webtest: class TestCase(unittest.TestCase): def setUp(self): app.config['TESTING'] = True self.client = webtest.TestApp(app) But when I try to visit urls through self.client.get() which are decorated with @login_required, I get a 401 error with a message that I am not authorized to access the url. According to the documentation https://flask-login.readthedocs.org/en/latest/#protecting-views and this discussion , setting the config value of 'TESTING' to True should disable the login

Run Python/Django Management Command from a UnitTest/WebTest

て烟熏妆下的殇ゞ 提交于 2019-12-03 11:06:43
问题 We have a bunch of commands in our Django site, some that are administrative and some that run on cron jobs that I can't figure out how to test. They pretty much look like this: # Saved in file /app/management/commands/some_command.py # Usage: python manage.py some_command from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): def handle_noargs(self, **options): # Do something useful And I have some tests, which look like this: import unittest from django.test

Run Python/Django Management Command from a UnitTest/WebTest

徘徊边缘 提交于 2019-12-03 01:30:50
We have a bunch of commands in our Django site, some that are administrative and some that run on cron jobs that I can't figure out how to test. They pretty much look like this: # Saved in file /app/management/commands/some_command.py # Usage: python manage.py some_command from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): def handle_noargs(self, **options): # Do something useful And I have some tests, which look like this: import unittest from django.test import TestCase from django_webtest import WebTest class SomeTest(WebTest): fixtures = ['testdata.json']

Insert 120 second wait in Visual studio Webtest

喜你入骨 提交于 2019-12-02 07:37:58
I want to add a delay of 120 second between the execution of two web requests. I have tried using think time but it won't pause the execution for 120 sec. Can anyone please let me know how to add wait to pause the execution for 120 second (after say 2 web request execution) and then proceed the execution for next request. I am using visual studio 2015. Think times are processed after the response is received. So to have a delay between two requests set the think time on the first request. I have successfully used long sleep times. Think times can be disabled in a test so make sure they are

Web test details are not displayed when ran from an ordered test

≡放荡痞女 提交于 2019-12-02 04:54:37
I have an ordered test that contains 4 web tests. The problem is that Visual Studio seems to have a problem loading the test results for an individual test. I included a screenshot to supplement for the 1000 words. :) As you may see the 3rd test, called intuitively Webservice03, failed. The screenshot above was taken after I double-clicked on the corresponding line to open the detailed information about that test run. The panels with requests and other useful information are empty. The issue is quite annoying, because the test is part of a bigger test suite that runs periodically, so when it

Escaping the Context Parameter format in a Visual Studio Web Test

浪子不回头ぞ 提交于 2019-12-02 04:33:46
问题 I am trying to work out how to pass a particular piece of data in a POST via a Visual Studio Web Test, without it being recognized and treated as a Context Parameter . The POST contains a (string) body that is a json document. Part of the body includes something like the following: "My Attribute":"Some test surrounding this {{SomeValue}} other stuff" The issue is that the Web Test is trying to match {{SomeValue}} to a Context Parameter (which doesn't exist) and so this request fails. The

Escaping the Context Parameter format in a Visual Studio Web Test

笑着哭i 提交于 2019-12-02 00:14:56
I am trying to work out how to pass a particular piece of data in a POST via a Visual Studio Web Test, without it being recognized and treated as a Context Parameter . The POST contains a (string) body that is a json document. Part of the body includes something like the following: "My Attribute":"Some test surrounding this {{SomeValue}} other stuff" The issue is that the Web Test is trying to match {{SomeValue}} to a Context Parameter (which doesn't exist) and so this request fails. The value is legitimate, and needs to be sent with the request as is. I've done some Googling and can't find

Calling REST API from Postman vs Visual Studio Webtest

元气小坏坏 提交于 2019-12-01 10:58:30
问题 I am facing one odd problem, I was able to make this (https://my.factcorp.com/ABCorp/Reporting/api/Events/) Rest API call from POSTMAN, but not from Visual Studio Web Test. PostMan call trace GET https://my.factcorp.com/ABCorp/Reporting/api/Events/ HTTP/1.1 Host: my.factcorp.com Connection: keep-alive Authorization: Basic Cache-Control: no-cache User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36 Postman-Token:

Using apache ant commands to store value to excel cell

回眸只為那壹抹淺笑 提交于 2019-11-29 17:24:38
I was curious if it was possible to store values into excel spreadsheet cells? And if so, how would one go about completing this? I also have multiple values that I would like to store into the same excel sheet but in different cells (like A2 or B1). For example, say that I have a value that I want to stick into cell A1, right now, I can actually using this command: <echo append="true" file="file.xls" message="1" /> This will store "1" in cell A1 and if I ran the same command again, it would store "1" in cell A1 as well, just next to the original echo. But I want is to have another value that