Exemple #1
0
    def test_update_staticapp(self):
        from azure.mgmt.web.models import StaticSiteARMResource, SkuDescription
        self.mock_cmd.get_models.return_value = StaticSiteARMResource, SkuDescription
        self.staticapp_client.get_static_site.return_value = self.app1
        self.staticapp_client.list.return_value = [self.app1, self.app2]
        tags = {'key1': 'value1'}
        sku = 'Standard'

        update_staticsite(self.mock_cmd,
                          self.name1,
                          self.source2,
                          self.branch2,
                          self.token2,
                          tags=tags,
                          sku=sku)

        self.staticapp_client.update_static_site.assert_called_once()
        arg_list = self.staticapp_client.update_static_site.call_args.kwargs
        self.assertEqual(self.name1, arg_list["name"])
        self.assertEqual(self.source2,
                         arg_list["static_site_envelope"].repository_url)
        self.assertEqual(self.branch2, arg_list["static_site_envelope"].branch)
        self.assertEqual(self.token2,
                         arg_list["static_site_envelope"].repository_token)
        self.assertEqual(tags, arg_list["static_site_envelope"].tags)
        self.assertEqual(sku, arg_list["static_site_envelope"].sku.name)
Exemple #2
0
    def test_update_staticapp_not_exist(self):
        from azure.mgmt.web.models import StaticSiteARMResource, SkuDescription
        self.mock_cmd.get_models.return_value = StaticSiteARMResource, SkuDescription
        self.staticapp_client.get_static_site.return_value = self.app1
        self.staticapp_client.list.return_value = [self.app1, self.app2]

        with self.assertRaises(CLIError):
            update_staticsite(self.mock_cmd, self.name1_not_exist)
Exemple #3
0
    def test_update_staticapp_with_no_values_passed_in(self):
        from azure.mgmt.web.models import StaticSiteARMResource, SkuDescription
        self.mock_cmd.get_models.return_value = StaticSiteARMResource, SkuDescription
        self.staticapp_client.get_static_site.return_value = self.app1
        self.staticapp_client.list.return_value = [self.app1, self.app2]

        update_staticsite(self.mock_cmd, self.name1)

        self.staticapp_client.update_static_site.assert_called_once()
        arg_list = self.staticapp_client.update_static_site.call_args.kwargs
        self.assertEqual(self.name1, arg_list["name"])
        self.assertEqual(self.source1,
                         arg_list["static_site_envelope"].repository_url)
        self.assertEqual(self.branch1, arg_list["static_site_envelope"].branch)
        self.assertEqual(self.token1,
                         arg_list["static_site_envelope"].repository_token)
        self.assertEqual(self.app1.tags, arg_list["static_site_envelope"].tags)
        self.assertEqual('Free', arg_list["static_site_envelope"].sku.name)