AndyRussG has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/188687

Change subject: WIP: Test fixtures: expand to cover more scenarios
......................................................................

WIP: Test fixtures: expand to cover more scenarios

Change-Id: Ie1a13adfb46f49c1eeeb885a85da7cb836f9294d
---
M includes/BannerAllocationCalculator.php
M tests/ApiCentralNoticeBannerChoiceDataTest.php
M tests/BannerAllocationCalculatorTest.php
M tests/BannerChoiceDataProviderTest.php
M tests/CNBannerChoicesResourceLoaderModuleTest.php
M tests/CentralNoticeTestFixtures.php
M tests/data/AllocationsFixtures.json
7 files changed, 152 insertions(+), 809 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/87/188687/1

diff --git a/includes/BannerAllocationCalculator.php 
b/includes/BannerAllocationCalculator.php
index 112f040..9e10f77 100644
--- a/includes/BannerAllocationCalculator.php
+++ b/includes/BannerAllocationCalculator.php
@@ -151,4 +151,15 @@
                }
                return $banners;
        }
+
+       static public function getLoggedInStatusFromString( $s ) {
+               switch ( $s ) {
+                       case 'anonymous':
+                               return BannerAllocationCalculator::ANONYMOUS;
+                       case 'logged_in':
+                               return BannerAllocationCalculator::LOGGED_IN;
+                       default:
+                               throw new MWException( 'Non-existent logged-in 
status.' );
+               }
+       }
 }
diff --git a/tests/ApiCentralNoticeBannerChoiceDataTest.php 
b/tests/ApiCentralNoticeBannerChoiceDataTest.php
index a8cb0f1..a9424f9 100644
--- a/tests/ApiCentralNoticeBannerChoiceDataTest.php
+++ b/tests/ApiCentralNoticeBannerChoiceDataTest.php
@@ -27,11 +27,16 @@
 
                $this->cnFixtures->setupTestCaseFromFixtureData( $testCase );
 
-               $ret = $this->doApiRequest( array(
-                       'action' => 'centralnoticebannerchoicedata',
-                       'project' => 
CentralNoticeTestFixtures::$defaultCampaign['projects'][0],
-                       'language' => 
CentralNoticeTestFixtures::$defaultCampaign['languages'][0]
-               ) );
-               $this->assertTrue( ComparisonUtil::assertSuperset( 
$ret[0]['choices'], $testCase['choices'] ) );
+               foreach ( $testCase['contexts_and_outputs'] as 
$context_and_output ) {
+
+                       $ret = $this->doApiRequest( array(
+                               'action' => 'centralnoticebannerchoicedata',
+                               'project' => 
$context_and_output['context']['project'],
+                               'language' => 
$context_and_output['context']['language']
+                       ) );
+
+                       $this->assertTrue( ComparisonUtil::assertSuperset( 
$ret[0]['choices'],
+                               $context_and_output['choices'] ) );
+               }
        }
 }
diff --git a/tests/BannerAllocationCalculatorTest.php 
b/tests/BannerAllocationCalculatorTest.php
index d681d2f..7bb43e6 100644
--- a/tests/BannerAllocationCalculatorTest.php
+++ b/tests/BannerAllocationCalculatorTest.php
@@ -27,23 +27,33 @@
 
                $this->cnFixtures->setupTestCaseFromFixtureData( $testCase );
 
-               $allocationsProvider = new BannerChoiceDataProvider(
-                       CentralNoticeTestFixtures::getDefaultProject(),
-                       CentralNoticeTestFixtures::getDefaultLanguage()
-               );
-               $choices = $allocationsProvider->getChoicesForCountry(
-                       CentralNoticeTestFixtures::getDefaultCountry()
-               );
-               $banners = 
BannerAllocationCalculator::filterAndTransformBanners(
-                       $choices,
-                       BannerAllocationCalculator::ANONYMOUS,
-                       CentralNoticeTestFixtures::getDefaultDevice(),
-                       0
-               );
-               $allocations = 
BannerAllocationCalculator::calculateAllocations( $banners );
+               foreach ( $testCase['contexts_and_outputs'] as 
$context_and_output ) {
 
-               $this->assertTrue(
-                       ComparisonUtil::assertEqualAllocations( $allocations, 
$testCase['allocations'] )
-               );
+                       $allocationsProvider = new BannerChoiceDataProvider(
+                               $context_and_output['context']['project'],
+                               $context_and_output['context']['language']
+                       );
+
+                       $choices = $allocationsProvider->getChoicesForCountry(
+                               CentralNoticeTestFixtures::getDefaultCountry()
+                       );
+
+                       $logged_in_status = BannerAllocationCalculator::
+                               getLoggedInStatusFromString(
+                               
$context_and_output['context']['logged_in_status'] );
+
+                       $banners = 
BannerAllocationCalculator::filterAndTransformBanners(
+                               $choices,
+                               $logged_in_status,
+                               $context_and_output['context']['device'],
+                               0
+                       );
+                       $allocations = 
BannerAllocationCalculator::calculateAllocations( $banners );
+       
+                       $this->assertTrue(
+                               ComparisonUtil::assertEqualAllocations( 
$allocations,
+                               $context_and_output['allocations'] )
+                       );
+               }
        }
 }
diff --git a/tests/BannerChoiceDataProviderTest.php 
b/tests/BannerChoiceDataProviderTest.php
index 7c28e8c..74b99ef 100644
--- a/tests/BannerChoiceDataProviderTest.php
+++ b/tests/BannerChoiceDataProviderTest.php
@@ -27,15 +27,21 @@
 
                $this->cnFixtures->setupTestCaseFromFixtureData( $testCase );
 
-               $allocationsProvider = new BannerChoiceDataProvider(
-                       
CentralNoticeTestFixtures::$defaultCampaign['projects'][0],
-                       
CentralNoticeTestFixtures::$defaultCampaign['languages'][0]
-               );
-               $choices = $allocationsProvider->getChoices();
-               $this->assertTrue( ComparisonUtil::assertSuperset( $choices, 
$testCase['choices'] ) );
+               foreach ( $testCase['contexts_and_outputs'] as 
$context_and_output ) {
 
-               if ( empty( $testCase['choices'] ) ) {
-                       $this->assertEmpty( $choices );
+                       $allocationsProvider = new BannerChoiceDataProvider(
+                               $context_and_output['context']['project'],
+                               $context_and_output['context']['language']
+                       );
+
+                       $choices = $allocationsProvider->getChoices();
+
+                       $this->assertTrue( ComparisonUtil::assertSuperset( 
$choices,
+                               $context_and_output['choices'] ) );
+
+                       if ( empty( $context_and_output['choices'] ) ) {
+                               $this->assertEmpty( $choices );
+                       }
                }
        }
 }
diff --git a/tests/CNBannerChoicesResourceLoaderModuleTest.php 
b/tests/CNBannerChoicesResourceLoaderModuleTest.php
index c15417d..35f353d 100644
--- a/tests/CNBannerChoicesResourceLoaderModuleTest.php
+++ b/tests/CNBannerChoicesResourceLoaderModuleTest.php
@@ -11,20 +11,7 @@
 
        protected function setUp() {
                parent::setUp();
-
-               $this->setMwGlobals( array(
-                       'wgCentralNoticeChooseBannerOnClient' => true,
-                       'wgNoticeProject' => 'wikipedia',
-               ) );
                $this->cnFixtures = new CentralNoticeTestFixtures();
-
-               $fauxRequest = new FauxRequest( array(
-                       'modules' => 'ext.centralNotice.bannerChoiceData',
-                       'skin' => 'fallback',
-                       'user' => false,
-                       'uselang' => 'en' // Note: this is a temporary measure 
-               ) );
-               $this->rlContext = new ResourceLoaderContext( new 
ResourceLoader(), $fauxRequest );
        }
 
        protected function tearDown() {
@@ -40,15 +27,23 @@
 
        protected function addSomeBanners() {
                $fixtures = CentralNoticeTestFixtures::allocationsData();
-               $completeness = $fixtures['test_cases']['completeness'];
-               $this->cnFixtures->setupTestCaseFromFixtureData( $completeness 
);
+               $test_case_w_banners = 
$fixtures['test_cases']['single_full_nongeo_anon'];
+               $this->cnFixtures->setupTestCaseFromFixtureData( 
$test_case_w_banners );
        }
 
        public function testDisabledByConfig() {
                $this->setMwGlobals( 'wgCentralNoticeChooseBannerOnClient', 
false );
 
                $this->addSomeBanners();
-               $script = $this->getProvider()->getScript( $this->rlContext );
+
+               $fauxRequest = new FauxRequest( array(
+                       'modules' => 'ext.centralNotice.bannerChoiceData',
+                       'skin' => 'fallback',
+                       'uselang' => 'en' // dummy value
+               ) );
+
+               $rlContext = new ResourceLoaderContext( new ResourceLoader(), 
$fauxRequest );
+               $script = $this->getProvider()->getScript( $rlContext );
 
                $this->assertEmpty( $script );
        }
@@ -61,11 +56,28 @@
 
                $this->cnFixtures->setupTestCaseFromFixtureData( $testCase );
 
-               $choices = $this->getProvider()->getChoicesForTesting( 
$this->rlContext );
-               $this->assertTrue( ComparisonUtil::assertSuperset( $choices, 
$testCase['choices'] ) );
+               foreach ( $testCase['contexts_and_outputs'] as 
$context_and_output ) {
 
-               if ( empty( $testCase['choices'] ) ) {
-                       $this->assertEmpty( $choices );
+                       $this->setMwGlobals( array(
+                                       'wgCentralNoticeChooseBannerOnClient' 
=> true,
+                                       'wgNoticeProject' => 
$context_and_output['context']['project']
+                       ) );
+
+                       $fauxRequest = new FauxRequest( array(
+                                       'modules' => 
'ext.centralNotice.bannerChoiceData',
+                                       'skin' => 'fallback',
+                                       'uselang' => 
$context_and_output['context']['language']
+                       ) );
+
+                       $rlContext = new ResourceLoaderContext( new 
ResourceLoader(), $fauxRequest );
+
+                       $choices = $this->getProvider()->getChoicesForTesting( 
$rlContext );
+                       $this->assertTrue( ComparisonUtil::assertSuperset(
+                               $choices, $context_and_output['choices'] ) );
+
+                       if ( empty( $context_and_output['choices'] ) ) {
+                               $this->assertEmpty( $choices );
+                       }
                }
        }
 }
diff --git a/tests/CentralNoticeTestFixtures.php 
b/tests/CentralNoticeTestFixtures.php
index 86f4e09..3b8a084 100644
--- a/tests/CentralNoticeTestFixtures.php
+++ b/tests/CentralNoticeTestFixtures.php
@@ -7,7 +7,8 @@
        protected $user;
        protected $fixtureDeviceId;
 
-       // Use exactly the api defaults where available
+       // For legacy test that don't use fixture data: use exactly the api 
defaults
+       // where available
        static public $defaultCampaign;
        static public $defaultBanner;
 
@@ -128,19 +129,21 @@
                        $campaign['endTs'] = wfTimestamp( TS_MW, $end );
                }
 
-               foreach ( $testCase['choices'] as &$choice ) {
-
-                       $choice['start'] = 
CentralNoticeTestFixtures::makeTimestamp(
-                                       $now, $choice['start_days_from_now'] );
-
-                       $choice['end'] = 
CentralNoticeTestFixtures::makeTimestamp(
-                                       $now, $choice['end_days_from_now'] );
-
-                       // Unset these special properties from choices, for 
tests that
-                       // compare fixture choices to actual choices produced 
by the code
-                       // under test.
-                       unset( $choice['start_days_from_now'] );
-                       unset( $choice['end_days_from_now'] );
+               foreach ( $testCase['contexts_and_outputs'] as 
&$context_and_output ) {
+                       foreach ( $context_and_output['choices'] as &$choice ) {
+       
+                               $choice['start'] = 
CentralNoticeTestFixtures::makeTimestamp(
+                                               $now, 
$choice['start_days_from_now'] );
+       
+                               $choice['end'] = 
CentralNoticeTestFixtures::makeTimestamp(
+                                               $now, 
$choice['end_days_from_now'] );
+       
+                               // Unset these special properties from choices, 
for tests that
+                               // compare fixture choices to actual choices 
produced by the code
+                               // under test.
+                               unset( $choice['start_days_from_now'] );
+                               unset( $choice['end_days_from_now'] );
+                       }
                }
        }
 
diff --git a/tests/data/AllocationsFixtures.json 
b/tests/data/AllocationsFixtures.json
index 3febe7d..d585fba 100644
--- a/tests/data/AllocationsFixtures.json
+++ b/tests/data/AllocationsFixtures.json
@@ -1,6 +1,7 @@
 {
     "test_cases": {
-        "completeness": {
+        "single_full_nongeo_anon": {
+            "comment": "A single, unthrottled, non-geotargeted campaign, with 
a banner for anonymous users on one device",
             "setup": {
                 "campaigns": [
                     {
@@ -9,22 +10,18 @@
                         "start_days_from_now": 0,
                         "end_days_from_now": 1,
                         "preferred": 1,
-                        "throttle": 50,
-                        "geotargeted": true,
-                        "countries": [
-                            "FR",
-                            "GR",
-                            "XX"
-                        ],
-                        "projects": ["wikipedia"],
+                        "throttle": 100,
+                        "geotargeted": false,
+                        "projects": ["test_project"],
                         "languages": ["en"],
+                        "archived": false,
                         "banners": [
                             {
                                 "name": "b1",
-                                "weight": 5,
+                                "weight": 25,
                                 "bucket": 0,
                                 "display_anon": true,
-                                "display_account": true,
+                                "display_account": false,
                                 "fundraising": 1,
                                 "devices": [
                                     "desktop"
@@ -34,745 +31,44 @@
                     }
                 ]
             },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 50,
-                    "bucket_count": 1,
-                    "geotargeted": true,
-                    "banners": [
-                        {
-                            "name": "b1",
-                            "bucket": 0,
-                            "weight": 5,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ],
-                    "countries": [
-                        "FR",
-                        "GR",
-                        "XX"
-                    ]
-                }
-            ],
-            "allocations": {
-                "b1": "0.500"
-            }
-        },
-
-        "throttling": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 3,
-                        "throttle": 60,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "c1b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            },
-                            {
-                                "name": "c1b2",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
+            "contexts_and_outputs": {
+                "as_targeted": {
+                    "comment": "Context targeted by the campaign (country 
shouldn't matter)",
+                    "context": {
+                        "project": "test_project",
+                        "language": "en",
+                        "country": "LU",
+                        "device": "desktop",
+                        "logged_in_status": "anonymous"
                     },
-                    {
-                        "name": "c2",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "c2b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            },
-                            {
-                                "name": "c2b2",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 3,
-                    "throttle": 60,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
+                    "choices": [
                         {
-                            "name": "c1b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        },
-                        {
-                            "name": "c1b2",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                },
-                {
-                    "name": "c2",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
-                        {
-                            "name": "c2b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        },
-                        {
-                            "name": "c2b2",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                }
-            ],
-            "allocations": {
-                "c1b1": "0.300",
-                "c1b2": "0.300",
-                "c2b1": "0.200",
-                "c2b2": "0.200"
-            }
-        },
-
-        "overallocation": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 5,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            },
-                            {
-                                "name": "b2",
-                                "weight": 100,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            },
-                            {
-                                "name": "b3",
-                                "weight": 100,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
-                        {
-                            "name": "b1",
-                            "bucket": 0,
-                            "weight": 5,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        },
-                        {
-                            "name": "b2",
-                            "bucket": 0,
-                            "weight": 100,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        },
-                        {
-                            "name": "b3",
-                            "bucket": 0,
-                            "weight": 100,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                }
-            ],
-            "allocations": {
-                "b1": "0.024",
-                "b2": "0.488",
-                "b3": "0.488"
-            }
-        },
-
-        "blanks": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 10,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 10,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
-                        {
-                            "name": "b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                }
-            ],
-            "allocations": {
-                "b1": 0.100
-            }
-        },
-
-        "priority": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "c1b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    },
-                    {
-                        "name": "c2",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 2,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "c2b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
-                        {
-                            "name": "c1b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                },
-                {
-                    "name": "c2",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 2,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
-                        {
-                            "name": "c2b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                }
-            ],
-            "allocations": {
-                "c1b1": 0.000,
-                "c2b1": 1.000
-            }
-        },
-
-        "geo_in_country": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "geotargeted": true,
-                        "countries": [
-                            "FR",
-                            "XX"
-                        ],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": true,
-                    "banners": [
-                        {
-                            "name": "b1",
-                            "weight": 25,
-                            "bucket": 0,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
+                            "name": "c1",
+                            "start_days_from_now": 0,
+                            "end_days_from_now": 1,
+                            "preferred": 1,
+                            "throttle": 100,
+                            "bucket_count": 1,
+                            "geotargeted": false,
+                            "banners": [
+                                {
+                                    "name": "b1",
+                                    "bucket": 0,
+                                    "weight": 25,
+                                    "category": "fundraising",
+                                    "display_anon": true,
+                                    "display_account": false,
+                                    "devices": [
+                                        "desktop"
+                                    ]
+                                }
                             ]
                         }
                     ],
-                    "countries": [
-                        "FR",
-                        "XX"
-                    ]
+                    "allocations": {
+                        "b1": "1"
+                    }
                 }
-            ],
-            "allocations": {
-                "b1": 1.000
-            }
-        },
-
-        "geo_not_in_country": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": true,
-                        "countries": [
-                            "FR",
-                            "GR"
-                        ],
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": true,
-                    "banners": [
-                        {
-                            "name": "b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": true,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ],
-                    "countries": [
-                        "FR",
-                        "GR"
-                    ]
-                }
-            ],
-            "allocations": {
-            }
-        },
-
-        "not_in_project": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": [ "wikisource" ],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-            ],
-            "allocations": {
-            }
-        },
-
-        "not_in_language": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": [ "zh" ],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-            ],
-            "allocations": {
-            }
-        },
-
-        "not_in_time_window": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 1,
-                        "end_days_from_now": 2,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": true,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-            ],
-            "allocations": {
-            }
-        },
-
-        "not_anonymous": {
-            "setup": {
-                "campaigns": [
-                    {
-                        "name": "c1",
-                        "enabled": 1,
-                        "start_days_from_now": 0,
-                        "end_days_from_now": 1,
-                        "preferred": 1,
-                        "throttle": 100,
-                        "geotargeted": false,
-                        "projects": ["wikipedia"],
-                        "languages": ["en"],
-                        "banners": [
-                            {
-                                "name": "b1",
-                                "weight": 25,
-                                "bucket": 0,
-                                "display_anon": false,
-                                "display_account": true,
-                                "fundraising": 1,
-                                "devices": [
-                                    "desktop"
-                                 ]
-                            }
-                        ]
-                    }
-                ]
-            },
-            "choices": [
-                {
-                    "name": "c1",
-                    "start_days_from_now": 0,
-                    "end_days_from_now": 1,
-                    "preferred": 1,
-                    "throttle": 100,
-                    "bucket_count": 1,
-                    "geotargeted": false,
-                    "banners": [
-                        {
-                            "name": "b1",
-                            "bucket": 0,
-                            "weight": 25,
-                            "category": "fundraising",
-                            "display_anon": false,
-                            "display_account": true,
-                            "devices": [
-                                "desktop"
-                            ]
-                        }
-                    ]
-                }
-            ],
-            "allocations": {
             }
         }
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/188687
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1a13adfb46f49c1eeeb885a85da7cb836f9294d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to