Esempio n. 1
0
	def test_update_po_save_error(self):
		data = {
			'name': 'changed_name',
			'guid': Dummies.get_or_create_po().guid,
			'type_id': Dummies.get_or_create_currency().guid
		}
		response = self.client.put(self.url, data = data, content_type = self.request_content_type)

		self.assertEqual(response.status_code, 500, response.content)
Esempio n. 2
0
	def setUp(self):
		self.url = '/api/cmn/po/'
		self.request_content_type = 'application/json'
		self.client = Client()

		user = Dummies.get_or_create_user()
		po = Dummies.get_or_create_po()
		self.client.login(username=user.username, password=Dummies.get_password())
		self.key = 'po'
Esempio n. 3
0
	def test_get_single_po_error(self):
		existing_po = Dummies.get_or_create_po()
		guid = existing_po.guid[5:] + 'test1'

		response = self.client.get(self.url + guid + '/', content_type = self.request_content_type)

		self.assertEqual(response.status_code, 404, response.content)

		content = json.loads(response.content)
		self.assertEqual(content.get('message').get('text'), 'The object {guid} is\'n found'.format(guid=guid))
Esempio n. 4
0
	def test_get_single_po_success(self):
		existing_po = Dummies.get_or_create_po()

		response = self.client.get(self.url + existing_po.guid + '/', content_type=self.request_content_type)

		self.assertEqual(response.status_code, 200, response.content)

		po = json.loads(response.content)

		self.assertIsInstance(po, dict, po)
		self.assertIn(self.key, po)
		self.assertEqual(po.get(self.key).get('guid'), existing_po.guid, po)
Esempio n. 5
0
	def test_update_po_success(self):
		data = {
			'name': 'changed_name',
			'guid': Dummies.get_or_create_po().guid
		}
		response = self.client.put(self.url, data = data, content_type = self.request_content_type)

		self.assertEqual(response.status_code, 200, response.content)

		content = json.loads(response.content)

		self.assertIsInstance(content, dict, content)
		self.assertIn(self.key, content)
		self.assertEqual(content.get(self.key).get('name'), data.get('name'))
	def setUp(self):
		self.url = '/api/cmn/transaction/'
		self.request_content_type = 'application/json'
		self.client = Client()

		self.user = Dummies.get_or_create_user()
		self.po = Dummies.get_or_create_po()
		self.transaction_status_success = Dummies.get_or_create_transaction_status('success')
		self.client.login(username = self.user.username, password = Dummies.get_password())
		self.key = 'transaction'

		self.new_transaction = {
			'date': 1462969764591,
			'value': '50000',
			'payment_object_id': self.po.guid
		}
	def setUp(self):
		self.url = '/api/cmn/transaction/'
		self.request_content_type = 'application/json'
		self.client = Client()

		self.user = Dummies.get_or_create_user()
		self.po = Dummies.get_or_create_po()
		self.transaction_status_success = Dummies.get_or_create_transaction_status('success')
		self.transaction_status_success = Dummies.get_or_create_transaction_status('error')
		self.supplier = Dummies.get_or_create_supplier()
		self.expense_item = Dummies.get_or_create_expense_item()

		self.client.login(username = self.user.username, password = Dummies.get_password())
		self.key = 'transaction'

		self.new_transaction = {
			'date': int(time.time()) * 100,
			'supplier_id': self.supplier.guid,
			'payment_object_id': self.po.guid,
			'expense_items': []
		}