Skip to content

Commit

Permalink
Added library memesis and changed registration files
Browse files Browse the repository at this point in the history
In this commit implemented issue extsoft#25
To run registration test case added randomize of data
with help of module faker. Module faker randomize next
data in registration test cases:
- first_name
- last_name
- phone
- email
- password
  • Loading branch information
alexbeatnik authored and extsoft committed May 16, 2019
1 parent c830d1b commit 9bd6c7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 6 additions & 4 deletions oct/tests/api/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
import requests
from pyats.aetest import Testcase, test, setup
from pyats.topology import Device
from mimesis import Person
from oct.tests import run_testcase
from oct.tests.api.registration_pattern import UserRegistration, Identity, Credentials
from oct.tests.web.creating_emails import EmailsGeneration


class Login(Testcase):
email = EmailsGeneration().creating_full_email()
password = "12345638"
generator = Person()
email = generator.email()
password = generator.password()

@setup
def create_account(self, device: Device) -> None:
assert "success" in UserRegistration(
Identity("Alex", "Ivanov", "+38090890812"), Credentials(self.email, self.password, "0")
Identity(self.generator.name(), self.generator.last_name(), self.generator.telephone()),
Credentials(self.email, self.password, "0"),
).registration_response(device)

@test
Expand Down
7 changes: 4 additions & 3 deletions oct/tests/api/registration.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# pylint: disable=no-self-use # pyATS-related exclusion
from pyats.aetest import Testcase, test
from pyats.topology import Device
from mimesis import Person
from oct.tests import run_testcase
from oct.tests.api.registration_pattern import UserRegistration, Identity, Credentials
from oct.tests.web.creating_emails import EmailsGeneration


class Registration(Testcase):
@test
def registration_positive_test(self, device: Device) -> None:
generator = Person()
assert "success" in UserRegistration(
Identity("Alex", "Ivanov", "+38090890812"),
Credentials(EmailsGeneration().creating_full_email(), "12345678", "0"),
Identity(generator.name(), generator.last_name(), generator.telephone()),
Credentials(generator.email(), generator.password(), "0"),
).registration_response(device)


Expand Down
8 changes: 4 additions & 4 deletions oct/tests/web/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
from pyats.aetest import Testcase, test
from pyats.topology import Device
from selenium.webdriver import Remote
from mimesis import Person
from oct.pages.registration import RegisterAccountPage, RegistrationSuccessPage
from oct.browsers import Chrome
from oct.tests import run_testcase
from oct.tests.web.creating_emails import EmailsGeneration


class Registration(Testcase):
@test
def test(self, grid: str, device: Device) -> None:
chrome: Remote = Chrome(grid)
registration = RegisterAccountPage(chrome)
random_email = EmailsGeneration()
registration.open(device)
generator = Person()
registration.fill_personal_details(
"Jon", "Doe", random_email.creating_full_email(), "123456"
generator.name(), generator.last_name(), generator.email(), generator.telephone()
)
registration.fill_password("supersecret")
registration.fill_password(generator.password())
registration.press_continue()
assert RegistrationSuccessPage(chrome).loaded()

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ requests==2.21.0
urllib3==1.24.2
paramiko==2.4.2
scp==0.13.2

mimesis==3.1.0
personal==0.1.1

0 comments on commit 9bd6c7d

Please sign in to comment.