Please enable JavaScript.
Coggle requires JavaScript to display documents.
django testing (mock/ to mock object (set return value of a queryset…
django testing
mock/ to mock object
mock model instance and add attribute to it
use MagicMock to mock post request
mock queryset
mock field and add queryset (also a mock) in it
mock return value of queryset method
set return value of a queryset
return_value
mock patch/ to mock method
mock
init
method of queryset, queryset needs to belong to a model
mock a method and return a value
mock filter of queryset
mock queryset method
mock middleware, method
assertion
grappa
should.equal()
test the value of a variable
should.have.only.key()
should.be.equal.to()
should.contain.only()
should.be.empty
Link
operator composition
chain of test
should.have.attribute()
check attribute of an object
should_have_been_called_with()
test whether a method is called
mock method
assert_called_with()
reset_mock
mock library
assertRaises()
built-in method
setUp
tearDown
unit testing framework
Link
test view, form_class
test form, add cleaned_data, get clean_data