forked from 47-studio-org/openlibrary
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_affiliate_links.py
29 lines (24 loc) · 988 Bytes
/
test_affiliate_links.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest
from splinter import Browser
class TestAffiliateLinks:
# host = 'https://openlibrary.org'
host = 'http://localhost:8080'
@pytest.fixture
def browser(self):
browser = Browser('chrome')
yield browser
browser.quit()
def test_affiliate_links_on_work(self, browser):
url = self.host + '/works/OL6037022W/Remix'
browser.visit(url)
assert browser.is_element_present_by_css(
"a[href*='www.amazon.com/dp/1408113473/?tag=internetarchi-20']"
)
assert browser.is_element_present_by_css("a[href*='www.betterworldbooks.com']")
def test_affiliate_links_on_edition(self, browser):
url = self.host + '/books/OL24218235M/Remix'
browser.visit(url)
assert browser.is_element_present_by_css(
"a[href*='www.amazon.com/dp/1408113473/?tag=internetarchi-20']"
)
assert browser.is_element_present_by_css("a[href*='www.betterworldbooks.com']")