testing

AnonymousUser with django.test.client.login()

三世轮回 提交于 2019-12-24 11:27:57
问题 I'm testing login function. def setUpClass(cls): super(BasePage_loggedin, cls).setUpClass() cls.selenium = WebDriver() cls.client = Client() cls.user_1 = MyUser.objects.create_user(username='myself',password='12345') cls.client.login(username=cls.user_1.username, password=cls.user_1.password) # create session cookie: session = SessionStore() session[SESSION_KEY] = cls.user_1.pk session[BACKEND_SESSION_KEY] = settings.AUTHENTICATION_BACKENDS[0] session[HASH_SESSION_KEY] = cls.user_1.get

Python Unittest: Fail due to import from same folder

最后都变了- 提交于 2019-12-24 11:22:46
问题 the question seems pretty trivial, but I could not find a single answer to it online. Heres my setup: project: - src: - - __init__.py (empty) - - file1.py - - file2.py - test: - - test1.py - - test2.py - - __init__.py (empty) Now, I want to run python -m unittest discover from the project folder. In test1.py I import and import from my first source file: from src.file1 import class1 In file1.py however, I import from the other one: from file2 import class2 Running the unittest as mentioned

Python 2D array i C using ctypes

偶尔善良 提交于 2019-12-24 10:56:56
问题 i'm trying to use a self written c lib to proces 2d array from python but with little success. Here is my c code: CamLibC.c int TableCam(const int x, const int y, int **Array) { int i = 0; int j = 0; for (i; i < x; i++) { for (j; j < y; j++) { Array[i][j] = 1; }; }; } cc -nostartfiles -shared -fPIC -o CamLibOS.os CamLibC.c Now here is my python wrapper: CamLibPy.py import os,sys import ctypes dirname = os.path.dirname(os.path.realpath(sys.argv[0])) CamLibFile = dirname + '/CamLibOS.os'

how to parameterize the value in json file - loadrunner

故事扮演 提交于 2019-12-24 10:40:24
问题 Need some help in loadrunner scripting with REST api. I have a requirement that LR script should always replace the unique parameter and this parameter should be part of Json body. File whatever i am using is huge. Hence, i created payload.json in extra files of LR. In Bodyfilepath i give this name of json file. In the payload.json i have parameterised a value (which needs to be unique every iteration) for request to be succesful. However, this paramter value is not getting replaced. Can

How to test an Ember model's computed property that has relations dependencies?

与世无争的帅哥 提交于 2019-12-24 10:40:04
问题 I'm writing Qunit tests to test An Ember model, but having a hard time testing computed properties that have a relation dependency (the computed property triggers another model's computed property). The model that am testing (CoffeeScript): Customer = DS.Model.extend firstName: DS.attr('string') lastName: DS.attr('string') phones: DS.attr('embedded-list') phone: (-> @get('phones.firstObject.number') ).property('phones.firstObject.number') fullName: (-> [@get('lastName'), @get('firstName')]

Gradle build / test failed - kryo.KryoException: Buffer overflow

余生颓废 提交于 2019-12-24 10:38:44
问题 While running a Gradle build, tests are failing. PS: 1. Gradle is using the correct JDK (1.6) to build. 2. I tried this with JDK 1.7, same error comes there as well. 3. I don't see this error when I build it locally (with JDK 1.6) on a linux/windows 4. machine but one of the machine is giving me this error. My ?s 1. What can be done to fix the com.esotericsoftware.kryo.KryoException: Buffer overflow error. 2. Why Gradle process failed, even when test section in build.gradle says: test {

rails3 rake does not run my tests

ε祈祈猫儿з 提交于 2019-12-24 10:37:59
问题 In a fresh R3 app, I seem to be unable to run any tests (there are 2, the canonical functional test for "/" and another unit test I created) See this output: rails_app$ rake test --trace (in /Users/jan/portfolio/rails_app) ** Invoke test (first_time, not_needed) rails_app$ What could be wrong? What is the meaning of first_time, not_needed'? t might have to do with the fact, that I am using Mongoid... 回答1: When I followed the instructions for Mongoid's installation, I replaced require 'rails

QTP: How do I match (or parametrize) line breaks in multiline edit controls?

烂漫一生 提交于 2019-12-24 10:37:35
问题 Consider this script: SystemUtil.Run "notepad.exe" With Window("Notepad") .WinEditor("Edit").Type "A" .WinEditor("Edit").Type micReturn .WinEditor("Edit").Type "B" .WinEditor("Edit").Check CheckPoint("Edit") End With The "Edit" checkpoint simply checks if the "Edit" WinEdit contains "A", CR, LF, "B". (This is exactly what the editor contains, you can verify by looking at GetROProperty ("Text") , it returns a string of length 4 with ASCII 65, 13, 10, 66, which is exactly what I'd expect.) I

grails: how to test controller with multiple actions and multiple redirects?

故事扮演 提交于 2019-12-24 10:24:25
问题 i am having the following problem: i want to test the logout action of my controller. before that i am calling the login method of my controller which both redirect to the same page. now I am getting the following error message: groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException: Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response. i do understand the problem, however all suggested solutions (calling the reset() method; calling

QTP: How do I get the “complex value” edit control in the checkpoint property edit dialog?

余生颓废 提交于 2019-12-24 10:04:34
问题 Consider this script: SystemUtil.Run "notepad.exe" With Window("Notepad") .WinEditor("Edit").Type "A" .WinEditor("Edit").Type micReturn .WinEditor("Edit").Type "B" .WinEditor("Edit").Check CheckPoint("Edit") End With The edit checkpoint simply checks if the Text property of the WinEditor is equal to what we entered: "A", carriage return, line feed, "B". (This is exactly what the editor contains, you can verify by looking at GetROProperty ("Text") , it returns a string of length 4 with ASCII