Exemplo n.º 1
0
 def test_get_all_campaigns(self):
     body_test = {"Data": "abc"}
     httpretty.register_uri(
         httpretty.GET,
         "https://app.selfadvertiser.com/api/v1/campaigns/0?token=cf0edf6a3ff26b2a646f5b1a07eac2ae",
         body=json.dumps(body_test))
     res = SelfAdvertiserService(
         "cf0edf6a3ff26b2a646f5b1a07eac2ae").get_all_campaigns()
     self.assertEqual(res, SelfAdvertiserObject(body_test))
Exemplo n.º 2
0
 def test_block_source(self):
     body_test = {"Data": "abc"}
     httpretty.register_uri(
         httpretty.POST,
         "https://app.selfadvertiser.com/api/v1/campaigns/~tUQKE1Egx5g,~z9WeghNkdlM/sources/black/123456,654321?token=cf0edf6a3ff26b2a646f5b1a07eac2ae",
         body=json.dumps(body_test))
     res = SelfAdvertiserService(
         "cf0edf6a3ff26b2a646f5b1a07eac2ae").block_source(
             ["~tUQKE1Egx5g", '~z9WeghNkdlM'], ["123456", "654321"])
     self.assertEqual(res, SelfAdvertiserObject(body_test))
Exemplo n.º 3
0
 def test_update_status_campaigns(self):
     body_test = {"Data": "abc"}
     httpretty.register_uri(
         httpretty.PUT,
         "https://app.selfadvertiser.com/api/v1/campaigns/~tUQKE1Egx5g/action/resume?token=cf0edf6a3ff26b2a646f5b1a07eac2ae",
         body=json.dumps(body_test))
     res = SelfAdvertiserService(
         "cf0edf6a3ff26b2a646f5b1a07eac2ae").update_status_campaigns(
             "~tUQKE1Egx5g", "resume")
     self.assertEqual(res, SelfAdvertiserObject(body_test))
Exemplo n.º 4
0
 def test_get_by_campaigns_id(self):
     body_test = {"Data": "abc"}
     httpretty.register_uri(
         httpretty.GET,
         "https://app.selfadvertiser.com/api/v1/campaigns/~tUQKE1Egx5g,~z9WeghNkdlM?token=cf0edf6a3ff26b2a646f5b1a07eac2ae",
         body=json.dumps(body_test))
     res = SelfAdvertiserService(
         "cf0edf6a3ff26b2a646f5b1a07eac2ae").get_by_campaigns_id(
             ['~tUQKE1Egx5g', '~z9WeghNkdlM'])
     self.assertEqual(res, SelfAdvertiserObject(body_test))