Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize second batch of Resources tests #83

Merged
merged 2 commits into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cadasta/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.5.3'
__version__ = '0.6.0'
50 changes: 0 additions & 50 deletions cadasta/test/base_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import pytest

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
from urllib.parse import urlparse

Expand Down Expand Up @@ -70,51 +68,3 @@ def log_in(self, user, field='username'):
self.wd.BY_NAME('sign-in').click()
label = user['full_name'] or user['username']
self.wd.wait_for_xpath(USER_MENU_XPATH_FORMAT.format(label))

def restore_password(self, password, changedPassword):
self.login_as("cadasta-test-user-1", changedPassword)
self.wd.wait_for_css('.btn-user')
self.open("/account/password/change/")
self.wd.find_css('#id_oldpassword').send_keys(changedPassword)
self.wd.find_css('#id_password').send_keys(password)
self.wd.find_elements_by_xpath(
"//button[contains(text(), 'Change password')]")[0].click()

def restore_username(self, username):
self.open("/account/profile/")
self.wd.find_css('#id_username').clear()
self.wd.find_css('#id_username').send_keys(username)
self.wd.find_element_by_xpath('//button[@name="update"]').click()

def restore_fullname(self, fullname):
self.open("/account/profile/")
self.wd.find_css('#id_full_name').clear()
self.wd.find_css('#id_full_name').send_keys(fullname)
self.wd.find_element_by_xpath('//button[@name="update"]').click()

def restore_email(self, email):
self.open("/account/profile/")
self.wd.find_css('#id_email').clear()
self.wd.find_css('#id_email').send_keys(email)
self.wd.find_element_by_xpath('//button[@name="update"]').click()

def register_new_user(self):
self.open("/dashboard/")
self.wd.find_element_by_xpath('//a[@href="/account/signup/"]').click()
self.wd.wait_for_css("#signup_form")
self.wd.find_css('#id_username').send_keys("cadasta-test-user-2")
self.wd.find_css('#id_email').send_keys("user2@abc.com")
self.wd.find_css("#id_password").send_keys('XYZ#qwerty')
self.wd.find_css("#id_full_name").send_keys('')
action = ActionChains(self.wd)
action.send_keys(Keys.TAB).send_keys(Keys.RETURN).perform()

try:
self.wd.find_elements_by_xpath(
"//*[contains(text(), "
"'Confirmation email sent to user2@abc.com.')]")
self.open("/account/logout/")
except Exception:
self.wd.find_elements_by_xpath(
"//*[contains(text(), "
"'A user with that username already exists.')]")
32 changes: 32 additions & 0 deletions cadasta/test/files/gpx_routes.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:gpxx="http://www.garmin.com/xmlschemas/WaypointExtension/v1"
xmlns:gpxtrx="http://www.garmin.com/xmlschemas/GpxExtensions/v3"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
creator="Oregon 550"
version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">
<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2016-09-01T08:50:59Z</time>
</metadata>
<rte>
<name>TEST ROUTE</name>
<rtept lat="52.946419" lon="-8.039839">
<name>Route point 1</name>
</rtept>
<rtept lat="53.063194" lon="-8.229833">
<name>Route point 2</name>
</rtept>
<rtept lat="53.537029" lon="-7.907280">
<name>Route point 3</name>
</rtept>
<rtept lat="54.116417" lon="-8.027824">
<name>Route point 4</name>
</rtept>
</rte>
</gpx>
59 changes: 59 additions & 0 deletions cadasta/test/files/gpx_tracks.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:gpxx="http://www.garmin.com/xmlschemas/WaypointExtension/v1"
xmlns:gpxtrx="http://www.garmin.com/xmlschemas/GpxExtensions/v3"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
creator="Oregon 550"
version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">
<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2015-03-27T16:57:30Z</time>
</metadata>
<trk>
<name>TEST TRACKS</name>
<extensions>
<gpxtrx:TrackExtension>
<gpxtrx:DisplayColor>DarkRed</gpxtrx:DisplayColor>
</gpxtrx:TrackExtension>
</extensions>
<trkseg>
<trkpt lat="52.352097" lon="-7.694680">
<ele>28.02</ele>
<time>2015-03-27T16:09:57Z</time>
</trkpt>
<trkpt lat="52.352097" lon="-7.694680">
<ele>28.50</ele>
<time>2015-03-27T16:10:14Z</time>
</trkpt>
<trkpt lat="52.352093" lon="-7.694676">
<ele>29.94</ele>
<time>2015-03-27T16:10:42Z</time>
</trkpt>
<trkpt lat="52.352116" lon="-7.694647">
<ele>29.46</ele>
<time>2015-03-27T16:10:53Z</time>
</trkpt>
<trkpt lat="52.352161" lon="-7.694512">
<ele>28.98</ele>
<time>2015-03-27T16:10:58Z</time>
</trkpt>
<trkpt lat="52.352165" lon="-7.694473">
<ele>28.98</ele>
<time>2015-03-27T16:11:00Z</time>
</trkpt>
<trkpt lat="52.352142" lon="-7.694223">
<ele>28.50</ele>
<time>2015-03-27T16:11:13Z</time>
</trkpt>
<trkpt lat="52.352238" lon="-7.694248">
<ele>28.50</ele>
<time>2015-03-27T16:11:21Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>
41 changes: 41 additions & 0 deletions cadasta/test/files/gpx_waypoints.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:gpxx="http://www.garmin.com/xmlschemas/WaypointExtension/v1"
xmlns:gpxtrx="http://www.garmin.com/xmlschemas/GpxExtensions/v3"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
creator="Oregon 550"
version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">
<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2016-05-18T09:20:06Z</time>
</metadata>
<wpt lat="52.941277" lon="-8.034792">
<ele>159.297363</ele>
<time>2016-05-18T09:20:06Z</time>
<name>Waypoint 1</name>
<sym>Lodging</sym>
</wpt>
<wpt lat="52.946419" lon="-8.039001">
<ele>88.808327</ele>
<time>2016-05-18T10:04:17Z</time>
<name>Waypoint 2</name>
<sym>Lodging</sym>
</wpt>
<wpt lat="52.946421" lon="-8.039008">
<ele>89.445007</ele>
<time>2016-05-18T10:06:58Z</time>
<name>Waypoint 3</name>
<sym>Crossing</sym>
</wpt>
<wpt lat="52.946064" lon="-8.038319">
<ele>87.765770</ele>
<time>2016-05-18T10:08:56Z</time>
<name>Waypoint 4</name>
<sym>Crossing</sym>
</wpt>
</gpx>
Loading