Revision 62a4a5ae

b/snf-astakos-app/astakos/im/tests/api.py
1
# -*- coding: utf-8 -*-
1 2
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
2 3
#
3 4
# Redistribution and use in source and binary forms, with or
......
60 61
        component1 = Component.objects.create(name="comp1")
61 62
        register.add_service(component1, "service1", "type1", [])
62 63
        # custom service resources
63
        resource11 = {"name": "service1.resource11",
64
                      "desc": "resource11 desc",
64
        resource11 = {"name": u"service1.ρίσορς11",
65
                      "desc": "ρίσορς11 desc",
65 66
                      "service_type": "type1",
66 67
                      "service_origin": "service1",
67 68
                      "ui_visible": True}
68 69
        r, _ = register.add_resource(resource11)
69 70
        register.update_base_default(r, 100)
70 71
        resource12 = {"name": "service1.resource12",
71
                      "desc": "resource11 desc",
72
                      "desc": "ρίσορς11 desc",
72 73
                      "service_type": "type1",
73 74
                      "service_origin": "service1",
74 75
                      "unit": "bytes"}
......
88 89
        register.add_service(component2, "service2", "type2", [])
89 90
        # create another service
90 91
        resource21 = {"name": "service2.resource21",
91
                      "desc": "resource11 desc",
92
                      "desc": "ρίσορς11 desc",
92 93
                      "service_type": "type2",
93 94
                      "service_origin": "service2",
94 95
                      "ui_visible": False}
......
169 170
        commission_request = {
170 171
            "force": False,
171 172
            "auto_accept": False,
172
            "name": "my commission",
173
            "name": u"ναμε",
173 174
            "provisions": [
174 175
                {
175 176
                    "holder": "user:" + user.uuid,
......
218 219
        body = json.loads(r.content)
219 220
        self.assertEqual(body['serial'], serial1)
220 221
        assertIn('issue_time', body)
222
        self.assertEqual(body["name"], u"ναμε")
221 223
        provisions = sorted(body['provisions'], key=lambda p: p['resource'])
222
        self.assertEqual(provisions, commission_request['provisions'])
224
        crp = sorted(commission_request['provisions'], key=lambda p: p['resource'])
225
        self.assertEqual(provisions, crp)
223 226
        self.assertEqual(body['name'], commission_request['name'])
224 227

  
225 228
        r = client.get(u('service_quotas?user=' + user.uuid), **s1_headers)
......
303 306

  
304 307
        commission_request = {
305 308
            "auto_accept": True,
306
            "name": "my commission",
309
            "name": "κομίσσιον",
307 310
            "provisions": "dummy"}
308 311

  
309 312
        post_data = json.dumps(commission_request)
b/snf-astakos-app/astakos/im/tests/projects.py
1
# -*- coding: utf-8 -*-
1 2
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
2 3
#
3 4
# Redistribution and use in source and binary forms, with or
......
49 50
    def setUp(self):
50 51
        self.client = Client()
51 52
        component1 = Component.objects.create(name="comp1")
52
        register.add_service(component1, "service1", "type1", [])
53
        register.add_service(component1, "σέρβις1", "type1", [])
53 54
        # custom service resources
54
        resource11 = {"name": "service1.resource11",
55
                      "desc": "resource11 desc",
55
        resource11 = {"name": u"σέρβις1.ρίσορς11",
56
                      "desc": u"ρίσορς11 desc",
56 57
                      "service_type": "type1",
57
                      "service_origin": "service1",
58
                      "service_origin": u"σέρβις1",
58 59
                      "ui_visible": True}
59 60
        r, _ = register.add_resource(resource11)
60 61
        register.update_base_default(r, 100)
61
        resource12 = {"name": "service1.resource12",
62
                      "desc": "resource11 desc",
62
        resource12 = {"name": u"σέρβις1.resource12",
63
                      "desc": "resource12 desc",
63 64
                      "service_type": "type1",
64
                      "service_origin": "service1",
65
                      "service_origin": u"σέρβις1",
65 66
                      "unit": "bytes"}
66 67
        r, _ = register.add_resource(resource12)
67 68
        register.update_base_default(r, 1024)
......
162 163
        self.assertEqual(status, 409)
163 164

  
164 165
        app1 = {"name": "test.pr",
166
                "description": u"δεσκρίπτιον",
165 167
                "end_date": "2013-5-5T20:20:20Z",
166 168
                "join_policy": "auto",
167 169
                "max_members": 5,
168
                "resources": {"service1.resource11": {
170
                "resources": {u"σέρβις1.ρίσορς11": {
169 171
                    "project_capacity": 1024,
170 172
                    "member_capacity": 512}}
171 173
                }
......
190 192
        self.assertEqual(body["last_application"]["state"], "pending")
191 193
        self.assertEqual(body["state"], "uninitialized")
192 194
        self.assertEqual(body["owner"], self.user1.uuid)
195
        self.assertEqual(body["description"], u"δεσκρίπτιον")
193 196

  
194 197
        # Approve forbidden
195 198
        status = self.project_action(project_id, "approve", app_id=app_id,
......
233 236
                "join_policy": "moderated",
234 237
                "leave_policy": "auto",
235 238
                "max_members": 3,
236
                "resources": {"service1.resource11": {
239
                "resources": {u"σέρβις1.ρίσορς11": {
237 240
                    "project_capacity": 1024,
238 241
                    "member_capacity": 1024}}
239 242
                }
......
597 600
        status, body = self.create(ap, h_owner)
598 601
        self.assertEqual(status, 400)
599 602

  
600
        ap["resources"] = {"service1.resource11": {
603
        ap["resources"] = {u"σέρβις1.ρίσορς11": {
601 604
                "member_capacity": 512}}
602 605
        status, body = self.create(ap, h_owner)
603 606
        self.assertEqual(status, 400)
604 607

  
605
        ap["resources"] = {"service1.resource11": {"member_capacity": 512,
606
                                                   "project_capacity": 1024}}
608
        ap["resources"] = {u"σέρβις1.ρίσορς11": {"member_capacity": 512,
609
                                                 "project_capacity": 1024}}
607 610
        status, body = self.create(ap, h_owner)
608 611
        self.assertEqual(status, 201)
609 612

  

Also available in: Unified diff