コード例 #1
0
 def test_bundling(self):
     self.assertEqual(
         get_asset_type(ChannelType).bundle_set(self.org, simulator=True),
         {
             "type":
             "channel",
             "url":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/channel/"),
             "content": [
                 {
                     "address": "+250785551212",
                     "country": "RW",
                     "name": "Test Channel",
                     "roles": ["send", "receive"],
                     "schemes": ["tel"],
                     "uuid": str(self.channel.uuid),
                 },
                 {
                     "address": "+18005551212",
                     "name": "Simulator Channel",
                     "roles": ["send"],
                     "schemes": ["tel"],
                     "uuid": "440099cf-200c-4d45-a8e7-4a564f4a0e8b",
                 },
             ],
         },
     )
     self.assertEqual(
         get_asset_type(ChannelType).bundle_item(self.org,
                                                 uuid=self.channel.uuid),
         {
             "type":
             "channel",
             "url":
             matchers.String(
                 pattern=
                 f"{TEST_ASSETS_BASE}{self.org.id}/\d+/channel/{str(self.channel.uuid)}/"
             ),
             "content": {
                 "address": "+250785551212",
                 "country": "RW",
                 "name": "Test Channel",
                 "roles": ["send", "receive"],
                 "schemes": ["tel"],
                 "uuid": str(self.channel.uuid),
             },
         },
     )
コード例 #2
0
 def test_get_asset_urls(self):
     self.assertEqual(
         get_asset_urls(self.org),
         {
             "channel":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/channel/"),
             "field":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/field/"),
             "flow":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/flow/"),
             "group":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/group/"),
             "label":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/label/"),
             "location_hierarchy":
             f"{TEST_ASSETS_BASE}{self.org.id}/1/location_hierarchy/",
             "resthook":
             matchers.String(
                 pattern=f"{TEST_ASSETS_BASE}{self.org.id}/\d+/resthook/"),
         },
     )