|
| 1 | +# -*- coding: utf-8 -*- |
1 | 2 | """ |
2 | 3 | Unit tests for the Deis api app. |
3 | 4 |
|
@@ -127,6 +128,29 @@ def test_config_set_same_key(self): |
127 | 128 | self.assertIn('PORT', json.loads(response.data['values'])) |
128 | 129 | self.assertEqual(json.loads(response.data['values'])['PORT'], '5001') |
129 | 130 |
|
| 131 | + @mock.patch('requests.post', mock_import_repository_task) |
| 132 | + def test_config_set_unicode(self): |
| 133 | + """ |
| 134 | + Test that config sets with unicode values are accepted. |
| 135 | + """ |
| 136 | + url = '/api/apps' |
| 137 | + body = {'cluster': 'autotest'} |
| 138 | + response = self.client.post(url, json.dumps(body), content_type='application/json') |
| 139 | + self.assertEqual(response.status_code, 201) |
| 140 | + app_id = response.data['id'] |
| 141 | + url = "/api/apps/{app_id}/config".format(**locals()) |
| 142 | + # set an initial config value |
| 143 | + body = {'values': json.dumps({'POWERED_BY': 'Деис'})} |
| 144 | + response = self.client.post(url, json.dumps(body), content_type='application/json') |
| 145 | + self.assertEqual(response.status_code, 201) |
| 146 | + self.assertIn('POWERED_BY', json.loads(response.data['values'])) |
| 147 | + # reset same config value |
| 148 | + body = {'values': json.dumps({'POWERED_BY': 'Кроликов'})} |
| 149 | + response = self.client.post(url, json.dumps(body), content_type='application/json') |
| 150 | + self.assertEqual(response.status_code, 201) |
| 151 | + self.assertIn('POWERED_BY', json.loads(response.data['values'])) |
| 152 | + self.assertEqual(json.loads(response.data['values'])['POWERED_BY'], 'Кроликов') |
| 153 | + |
130 | 154 | @mock.patch('requests.post', mock_import_repository_task) |
131 | 155 | def test_config_str(self): |
132 | 156 | """Test the text representation of a node.""" |
|
0 commit comments