Fix more tests.
These were broken due to me rebasing before sending a PR off.  They
should work now.
(cherry picked from commit 4cb15e0a0f)
			
			
This commit is contained in:
		
							parent
							
								
									faba254be5
								
							
						
					
					
						commit
						fb9e5c4a2b
					
				| @ -16,6 +16,7 @@ | |||||||
| # | # | ||||||
| import unittest | import unittest | ||||||
| 
 | 
 | ||||||
|  | from pylorax.api.errors import INVALID_CHARS | ||||||
| from composer.cli.utilities import argify, toml_filename, frozen_toml_filename, packageNEVRA | from composer.cli.utilities import argify, toml_filename, frozen_toml_filename, packageNEVRA | ||||||
| from composer.cli.utilities import handle_api_result | from composer.cli.utilities import handle_api_result | ||||||
| 
 | 
 | ||||||
| @ -53,8 +54,8 @@ class CliUtilitiesTest(unittest.TestCase): | |||||||
|         self.assertEqual(handle_api_result(result, show_json=False), (0, False)) |         self.assertEqual(handle_api_result(result, show_json=False), (0, False)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_2(self): |     def test_api_result_2(self): | ||||||
|         """Test a result with errors=["some error"], and no status field""" |         """Test a result with errors=[{"id": INVALID_CHARS, "msg": "some error"}], and no status field""" | ||||||
|         result = {"foo": "bar", "errors": ["some error"]} |         result = {"foo": "bar", "errors": [{"id": INVALID_CHARS, "msg": "some error"}]} | ||||||
|         self.assertEqual(handle_api_result(result, show_json=False), (1, False)) |         self.assertEqual(handle_api_result(result, show_json=False), (1, False)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_3(self): |     def test_api_result_3(self): | ||||||
| @ -68,8 +69,8 @@ class CliUtilitiesTest(unittest.TestCase): | |||||||
|         self.assertEqual(handle_api_result(result, show_json=False), (1, True)) |         self.assertEqual(handle_api_result(result, show_json=False), (1, True)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_5(self): |     def test_api_result_5(self): | ||||||
|         """Test a result with status=False, and errors=["some error"]""" |         """Test a result with status=False, and errors=[{"id": INVALID_CHARS, "msg": "some error"}]""" | ||||||
|         result = {"status": False, "errors": ["some error"]} |         result = {"status": False, "errors": [{"id": INVALID_CHARS, "msg": "some error"}]} | ||||||
|         self.assertEqual(handle_api_result(result, show_json=False), (1, True)) |         self.assertEqual(handle_api_result(result, show_json=False), (1, True)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_6(self): |     def test_api_result_6(self): | ||||||
| @ -78,13 +79,13 @@ class CliUtilitiesTest(unittest.TestCase): | |||||||
|         self.assertEqual(handle_api_result(result, show_json=True), (0, True)) |         self.assertEqual(handle_api_result(result, show_json=True), (0, True)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_7(self): |     def test_api_result_7(self): | ||||||
|         """Test a result with show_json=True, status=False, and errors=["some error"]""" |         """Test a result with show_json=True, status=False, and errors=[{"id": INVALID_CHARS, "msg": "some error"}]""" | ||||||
|         result = {"status": False, "errors": ["some error"]} |         result = {"status": False, "errors": [{"id": INVALID_CHARS, "msg": "some error"}]} | ||||||
|         self.assertEqual(handle_api_result(result, show_json=True), (1, True)) |         self.assertEqual(handle_api_result(result, show_json=True), (1, True)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_8(self): |     def test_api_result_8(self): | ||||||
|         """Test a result with show_json=True, errors=["some error"], and no status field""" |         """Test a result with show_json=True, errors=[{"id": INVALID_CHARS, "msg": "some error"}], and no status field""" | ||||||
|         result = {"foo": "bar", "errors": ["some error"]} |         result = {"foo": "bar", "errors": [{"id": INVALID_CHARS, "msg": "some error"}]} | ||||||
|         self.assertEqual(handle_api_result(result, show_json=True), (1, True)) |         self.assertEqual(handle_api_result(result, show_json=True), (1, True)) | ||||||
| 
 | 
 | ||||||
|     def test_api_result_9(self): |     def test_api_result_9(self): | ||||||
|  | |||||||
| @ -1036,7 +1036,7 @@ class ServerTestCase(unittest.TestCase): | |||||||
|         self.assertEqual(resp.status_code, 400) |         self.assertEqual(resp.status_code, 400) | ||||||
|         self.assertEqual(data["status"], False) |         self.assertEqual(data["status"], False) | ||||||
|         self.assertTrue(len(data["errors"]) > 0) |         self.assertTrue(len(data["errors"]) > 0) | ||||||
|         self.assertTrue("Invalid characters in" in data["errors"][0]) |         self.assertTrue("Invalid characters in" in data["errors"][0]["msg"]) | ||||||
| 
 | 
 | ||||||
|     def test_blueprints_list_branch(self): |     def test_blueprints_list_branch(self): | ||||||
|         resp = self.server.get("/api/v0/blueprints/list?branch=" + UTF8_TEST_STRING) |         resp = self.server.get("/api/v0/blueprints/list?branch=" + UTF8_TEST_STRING) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user