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
9bec82b1
Commit
9bec82b1
authored
Aug 22, 2013
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase test coverage
parent
da3be8ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
tests/test.py
+0
-5
tests/test_asnum.py
+9
-0
tests/test_country.py
+16
-0
No files found.
tests/test.py
View file @
9bec82b1
...
...
@@ -17,11 +17,6 @@ class TestGenerals(unittest.TestCase):
assert
len
(
const
.
COUNTRY_CODES
)
==
len
(
const
.
COUNTRY_NAMES
)
assert
len
(
const
.
COUNTRY_CODES
)
==
len
(
const
.
CONTINENT_NAMES
)
def
testMetaclass
(
self
):
a
=
pygeoip
.
GeoIP
(
filename
=
COUNTRY_DB_PATH
)
b
=
pygeoip
.
GeoIP
(
filename
=
COUNTRY_DB_PATH
)
assert
a
is
b
@raises
(
pygeoip
.
GeoIPError
)
def
testCorruptDatabase
(
self
):
gi
=
pygeoip
.
GeoIP
(
filename
=
CORRUPT_DB_PATH
)
...
...
tests/test_asnum.py
View file @
9bec82b1
# -*- coding: utf-8 -*-
import
unittest
from
nose.tools
import
raises
import
pygeoip
from
tests.config
import
ASNUM_DB_PATH
...
...
@@ -30,3 +31,11 @@ class TestGeoIPASNumFunctions(unittest.TestCase):
self
.
assertEqual
(
gb_as
,
self
.
gb_as
)
self
.
assertEqual
(
us_as
,
self
.
us_as
)
@raises
(
pygeoip
.
GeoIPError
)
def
testCodeByAddr
(
self
):
self
.
gia
.
country_code_by_addr
(
self
.
us_ip
)
@raises
(
pygeoip
.
GeoIPError
)
def
testNameByAddr
(
self
):
self
.
gia
.
country_name_by_addr
(
self
.
us_ip
)
tests/test_country.py
View file @
9bec82b1
...
...
@@ -75,3 +75,19 @@ class TestGeoIPCountryFunctions(unittest.TestCase):
def
testOpen6With4
(
self
):
data
=
self
.
gi6
.
country_code_by_addr
(
self
.
gb_ip
)
raise
ValueError
(
data
)
@raises
(
pygeoip
.
GeoIPError
)
def
testOrgByAddr
(
self
):
self
.
gi
.
org_by_addr
(
self
.
us_ip
)
@raises
(
pygeoip
.
GeoIPError
)
def
testRecordByAddr
(
self
):
self
.
gi
.
record_by_addr
(
self
.
us_ip
)
@raises
(
pygeoip
.
GeoIPError
)
def
testRegionByAddr
(
self
):
self
.
gi
.
region_by_addr
(
self
.
us_ip
)
@raises
(
pygeoip
.
GeoIPError
)
def
testTimeZoneByAddr
(
self
):
self
.
gi
.
time_zone_by_addr
(
self
.
us_ip
)
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