Ejemplo n.º 1
0
 def test_create_configuration(self):
     mocked_session = create_mocked_session()
     client = Azion(session=mocked_session)
     client.create_configuration('Dummy configuration', 'www.example.com',
                                 'ww2.example.com')
     mocked_session.post.assert_called_once_with(
         'https://api.azion.net/content_delivery/configurations',
         json={
             'name': 'Dummy configuration',
             'origin_address': 'www.example.com',
             'origin_host_header': 'ww2.example.com',
             'cname_access_only': False,
             'delivery_protocol': 'http',
             'origin_protocol_policy': 'preserve',
             'browser_cache_settings': False,
             'browser_cache_settings_maximum_ttl': 0,
             'cdn_cache_settings': 'honor',
             'cdn_cache_settings_maximum_ttl': 0
         })
Ejemplo n.º 2
0
    def test_create_configuration(self):
        client = Azion(token)
        recorder = betamax.Betamax(client.session)

        with recorder.use_cassette('Configuration_create'):
            configuration = client.create_configuration(
                'Dummy configuration',
                'www.example.com',
                'ww2.example.com',
                cname=['www.example-cname.com'],
                delivery_protocol='http')

        assert isinstance(configuration, Configuration)
        assert configuration.active is True
        assert configuration.id
        assert configuration.cname == ['www.example-cname.com']
        assert configuration.digital_certificate is None
        assert configuration.rawlogs is False
        assert configuration.delivery_protocol == 'http'
        assert configuration.cname_access_only is False
        assert configuration.name == 'Dummy configuration'
        assert configuration.domain_name