Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pygeoip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pygeoip
Commits
6c7a2aec
Commit
6c7a2aec
authored
Sep 28, 2012
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test to work with referenced sample databases
parent
980d8f6c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
tests/test_org.py
+3
-3
tests/test_region.py
+9
-10
No files found.
tests/test_org.py
View file @
6c7a2aec
...
...
@@ -7,9 +7,9 @@ from tests.config import ORG_DB_PATH
class
TestGeoIPOrgFunctions
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
us_org
=
'
Google
'
self
.
us_ip
=
'
64.233.161.99
'
self
.
us_hostname
=
'
goog
le.com'
self
.
us_org
=
'
APPLE COMPUTER
'
self
.
us_ip
=
'
17.172.224.47
'
self
.
us_hostname
=
'
app
le.com'
self
.
gb_org
=
'BBC'
self
.
gb_ip
=
'212.58.253.68'
...
...
tests/test_region.py
View file @
6c7a2aec
...
...
@@ -8,10 +8,9 @@ from tests.config import REGION_DB_PATH
class
TestGeoIPRegionFunctions
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
us_code
=
'US'
self
.
yahoo_hostname
=
'yahoo.com'
self
.
yahoo_ip
=
'209.131.36.159'
self
.
yahoo_region_data
=
{
self
.
us_hostname
=
'apple.com'
self
.
us_ip
=
'17.172.224.47'
self
.
us_region_data
=
{
'region_name'
:
'CA'
,
'country_code'
:
'US'
}
...
...
@@ -19,17 +18,17 @@ class TestGeoIPRegionFunctions(unittest.TestCase):
self
.
gir
=
pygeoip
.
GeoIP
(
REGION_DB_PATH
)
def
testRegionByName
(
self
):
region_name
=
self
.
gir
.
region_by_name
(
self
.
yahoo
_hostname
)
self
.
assertEqual
(
region_name
,
self
.
yahoo
_region_data
)
region_name
=
self
.
gir
.
region_by_name
(
self
.
us
_hostname
)
self
.
assertEqual
(
region_name
,
self
.
us
_region_data
)
def
testRegionByAddr
(
self
):
region_name
=
self
.
gir
.
region_by_addr
(
self
.
yahoo
_ip
)
self
.
assertEqual
(
region_name
,
self
.
yahoo
_region_data
)
region_name
=
self
.
gir
.
region_by_addr
(
self
.
us
_ip
)
self
.
assertEqual
(
region_name
,
self
.
us
_region_data
)
def
testCountryCodeByName
(
self
):
us_code
=
self
.
gir
.
country_code_by_name
(
self
.
yahoo
_hostname
)
us_code
=
self
.
gir
.
country_code_by_name
(
self
.
us
_hostname
)
self
.
assertEqual
(
us_code
,
self
.
us_code
)
def
testCountryCodeByAddr
(
self
):
us_code
=
self
.
gir
.
country_code_by_addr
(
self
.
yahoo
_ip
)
us_code
=
self
.
gir
.
country_code_by_addr
(
self
.
us
_ip
)
self
.
assertEqual
(
us_code
,
self
.
us_code
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment