On Github vharitonsky / not_testing
from project.lib.testing.testcase import TestCase class TestMath(TestCase): def test_plus(self): self.assertEqual(2 + 2, 4, "Something is awry")
pi test app -t project/tests/test_math.py
make test tests=project/tests/test_math
class PublicationListTestCase(TestCase):
records = [CompanyOwnerAndAdmin]
def test_smoke_publication_list_page(self):
login(CompanyOwnerAndAdmin)
page_url = url.cabinet.absolute(
controller='publication',
action='index'
)
resp = app.get(page_url)
self.assertEqual(200, resp.status_int)
class BaseAttributeBinding(Record):
__model__ = AttributeBinding
id = unique(rand.int, min=2 ** 30, max=2 ** 31 - 1)
attribute = BaseAttribute
category = BaseProductCategory
position = unique(rand.int, min=2 ** 30, max=2 ** 31 - 1)
user = BaseUser
help = unique(rand.unicode, 255)
group = BaseAttributeBindingGroup
attribute_values = [BaseMultiSelectAttributeValue]
value = {
"munit_id": 36011, # кг
"min": None,
"max": None,
}
from project.lib.testing.mailbox import mailbox
from project.lib.testing.taskqueue import taskqueue_ctx, taskqueue
class TestAuctionNotification(TestCase):
records = [ActiveStatePurchase, Merchant]
context_managers = [request_ctx, taskqueue_ctx]
def test_email_notification(self):
notify_auction_next_day()
self.assertEqual(len(mailbox), 1)
notify_auction_next_day.delay()
self.assertEqual(len(taskqueue), 1)
from mock import patch
class TestApiRequest(unittest.TestCase):
@patch('requests.post',
_patch_request_post_citywarehouses_response)
def test_api_request_with_correct_response(self):
query = ['file', {}, [
['auth', {}, u"Ваш Ключ"],
['citywarehouses', {}, []],
]]
result, error = api_request(query)
self.assertIsNone(error)
self.assertIsNotNone(result)
describe("VendorPeek Test Suite", function(){
beforeEach(function(){
$(document.body).append($("<div id='container'>"))
});
it("support company row must contain something", function(){
render(
SupportCompanyRow({
first: true,
name:"Samsung",
address:"Somewhere"}),
$("#container")
);
var html = $("#container").html();
expect(html).not.toEqual('');
});