+
+ def test__get_resource_allocation_params_with_empty_target_image(self):
+ expected_result = {}
+ quota_descriptor = {}
+
+ result = Ns._get_resource_allocation_params(
+ quota_descriptor=quota_descriptor,
+ )
+
+ self.assertDictEqual(expected_result, result)
+
+ def test__get_resource_allocation_params_with_wrong_target_image(self):
+ expected_result = {}
+ quota_descriptor = {
+ "no_quota": "present_here",
+ }
+
+ result = Ns._get_resource_allocation_params(
+ quota_descriptor=quota_descriptor,
+ )
+
+ self.assertDictEqual(expected_result, result)
+
+ def test__get_resource_allocation_params_with_limit(self):
+ expected_result = {
+ "limit": 10,
+ }
+ quota_descriptor = {
+ "limit": "10",
+ }
+
+ result = Ns._get_resource_allocation_params(
+ quota_descriptor=quota_descriptor,
+ )
+
+ self.assertDictEqual(expected_result, result)
+
+ def test__get_resource_allocation_params_with_reserve(self):
+ expected_result = {
+ "reserve": 20,
+ }
+ quota_descriptor = {
+ "reserve": "20",
+ }
+
+ result = Ns._get_resource_allocation_params(
+ quota_descriptor=quota_descriptor,
+ )
+
+ self.assertDictEqual(expected_result, result)
+
+ def test__get_resource_allocation_params_with_shares(self):
+ expected_result = {
+ "shares": 30,
+ }
+ quota_descriptor = {
+ "shares": "30",
+ }
+
+ result = Ns._get_resource_allocation_params(
+ quota_descriptor=quota_descriptor,
+ )
+
+ self.assertDictEqual(expected_result, result)
+
+ def test__get_resource_allocation_params(self):
+ expected_result = {
+ "limit": 10,
+ "reserve": 20,
+ "shares": 30,
+ }
+ quota_descriptor = {
+ "limit": "10",
+ "reserve": "20",
+ "shares": "30",
+ }
+
+ result = Ns._get_resource_allocation_params(
+ quota_descriptor=quota_descriptor,
+ )
+
+ self.assertDictEqual(expected_result, result)