예제 #1
0
파일: campaigns.py 프로젝트: ysomad/keitaro
 def create(self,
            name,
            *,
            alias=None,
            type=None,
            state=None,
            cost_type=None,
            cookies_ttl=None,
            cost_value=None,
            cost_currency=None,
            cost_auto=False,
            group_id=None,
            token=None,
            traffic_source_id=None,
            bind_visitors=None,
            parameters=None,
            domain_id=None,
            postbacks=None):
     """
     Creates new advertising campaign
     """
     query_params = remove_key_values(locals())
     # TODO: add only if doesn't exist
     query_params['alias'] = generate_random_string()
     return super(Campaign, self).post(**query_params)
예제 #2
0
def test_create(client):
    random_string = generate_random_string()
    login = f'TestUser{random_string}'
    password = random_string
    user_type = 'ADMIN'
    resp = client.users.create(login, password, user_type)
    data = resp.json()
    assert resp.status_code == 200
    assert data['login'] == login
    assert data['type'] == user_type
예제 #3
0
def test_update(client):
    random_aff = random.choice(client.affiliate_networks.get().json())
    random_string = generate_random_string()
    name = f'Updated name {random_string}'
    postback_url = f'https://{random_string}.com'
    resp = client.affiliate_networks.update(random_aff['id'], name,
                                            postback_url)
    data = resp.json()
    assert resp.status_code == 200
    assert data['id'] == random_aff['id']
    assert data['name'] == name
    assert data['postback_url'] == postback_url
예제 #4
0
def test_create(client):
    random_string = generate_random_string(6)
    name = f'test LP {random_string}'
    action_type = random.choice(
        ('local_file', 'http', 'curl', 'status404', 'show_text', 'show_html'))
    url = f'https://{random_string}.net'
    resp = client.landing_pages.create(name,
                                       action_type=action_type,
                                       action_payload=url)
    data = resp.json()
    assert resp.status_code == 200
    assert isinstance(data, dict)
    assert data['name'] == name
    assert data['action_payload'] == url
    assert data['action_type'] == action_type
예제 #5
0
def test_update(client):
    random_domain = random.choice(client.domains.get().json())
    random_string = generate_random_string().lower()
    new_name = f'https://updated{random_string}.com'
    state = 'disabled'
    notes = f'updated domain {random_string}'
    resp = client.domains.update(random_domain['id'],
                                 name=new_name,
                                 state=state,
                                 notes=notes)
    data = resp.json()
    assert resp.status_code == 200
    assert data['id'] == random_domain['id']
    assert data['name'] == new_name
    assert data['state'] == state
    assert data['notes'] == notes
예제 #6
0
def test_create(client):
    random_string = generate_random_string()
    name = f'Test AN {random_string}'
    postback_url = f'https://{random_string}.com/'
    notes = 'Test notes'
    state = 'active'
    resp = client.affiliate_networks.create(name=name,
                                            postback_url=postback_url,
                                            notes=notes,
                                            state=state)
    data = resp.json()
    assert resp.status_code == 200
    assert isinstance(data, dict)
    assert data['name'] == name
    assert data['postback_url'] == postback_url
    assert data['notes'] == notes
    assert data['state'] == state