-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e388f83
commit 7c16d4e
Showing
7 changed files
with
139 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned | ||
|
||
import pytest | ||
|
||
from twerk import utils | ||
from twerk.views import private, public | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def browser(): | ||
with utils.get_browser(headless=True) as browser: | ||
yield browser | ||
|
||
|
||
@pytest.fixture | ||
def credentials(): | ||
try: | ||
return utils.get_credentials(prompt=False) | ||
except EnvironmentError as e: | ||
pytest.skip(str(e)) | ||
|
||
|
||
def describe_public_views(): | ||
def describe_profile(): | ||
@pytest.fixture(scope="module") | ||
def profile(browser): | ||
return public.Profile(browser, username="jack") | ||
|
||
@pytest.mark.flaky | ||
def it_contains_properties(expect, profile): | ||
expect(profile.tweets) > 0 | ||
expect(profile.following) > 0 | ||
expect(profile.followers) > 0 | ||
expect(profile.likes) > 0 | ||
expect(profile.joined) != None | ||
|
||
|
||
def describe_private_views(): | ||
def describe_profile(): | ||
@pytest.fixture | ||
def profile(browser, credentials): | ||
return private.Profile(browser, username="jack", credentials=credentials) | ||
|
||
@pytest.mark.flaky | ||
def it_contains_properties(expect, profile): | ||
expect(profile.tweets) > 0 | ||
expect(profile.following) > 0 | ||
expect(profile.followers) > 0 | ||
expect(profile.likes) == 0 # not yet supported | ||
expect(profile.joined) != None | ||
|
||
def describe_profile_block(): | ||
@pytest.fixture | ||
def profile_block(browser, credentials): | ||
return private.ProfileBlock( | ||
browser, username="jack", credentials=credentials | ||
) | ||
|
||
@pytest.mark.flaky | ||
def it_can_cancel(expect, profile_block): | ||
view = profile_block.cancel() | ||
expect(view).isinstance(private.Profile) | ||
|
||
def describe_profile_report(): | ||
@pytest.fixture | ||
def profile_report(browser, credentials): | ||
return private.ProfileReport( | ||
browser, username="jack", credentials=credentials | ||
) | ||
|
||
@pytest.mark.flaky | ||
def it_can_cancel(expect, profile_report): | ||
view = profile_report.cancel() | ||
expect(view).isinstance(private.Profile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters