def test_get_by_xsolla_id__different_by_test(self): self.assertEqual(InvoicePrototype._db_count(), 0) invoice_real = self.create_invoice(worker_call_count=1, xsolla_id='1', test='0') invoice_test = self.create_invoice(worker_call_count=1, xsolla_id='1', test='1') self.assertEqual(InvoicePrototype._db_count(), 2) self.assertNotEqual(invoice_test.id, invoice_real.id) self.assertEqual(InvoicePrototype.get_by_xsolla_id(1, False).id, invoice_real.id) self.assertEqual(InvoicePrototype.get_by_xsolla_id(1, True).id, invoice_test.id)
def test_get_by_xsolla_id__different_by_test(self): self.assertEqual(InvoicePrototype._db_count(), 0) invoice_real = self.create_invoice(worker_call_count=1, xsolla_id='1', test='0') invoice_test = self.create_invoice(worker_call_count=1, xsolla_id='1', test='1') self.assertEqual(InvoicePrototype._db_count(), 2) self.assertNotEqual(invoice_test.id, invoice_real.id) self.assertEqual( InvoicePrototype.get_by_xsolla_id(1, False).id, invoice_real.id) self.assertEqual( InvoicePrototype.get_by_xsolla_id(1, True).id, invoice_test.id)
def test_get_by_xsolla_id__not_exists_by_test(self): self.create_invoice(worker_call_count=1, xsolla_id='2', test='1') self.assertEqual(InvoicePrototype.get_by_xsolla_id(2, False), None) self.create_invoice(worker_call_count=1, xsolla_id='3', test='0') self.assertEqual(InvoicePrototype.get_by_xsolla_id(3, True), None)