Skip to content

Commit

Permalink
Move nomorobo unit tests to test_nomorobo.py
Browse files Browse the repository at this point in the history
- Re: #67
  • Loading branch information
emxsys committed Aug 19, 2020
1 parent 5a53c4a commit 297d8f5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/screening/nomorobo.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,3 @@ def __init__(self, spam_threshold=2):
self.spam_threshold = spam_threshold


def test(args):
nomorobo = NomoroboService()
result = nomorobo.lookup_number("5622862616")
print(result)
return 0


if __name__ == '__main__':
import sys
sys.exit(test(sys.argv))
print("Done")
44 changes: 44 additions & 0 deletions tests/test_nomorobo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_nomorobo.py
#
# Copyright 2020 Bruce Schubert <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import os
import sys
import sqlite3
from pprint import pprint

import pytest

from src.callattendant import make_config
from src.screening.nomorobo import NomoroboService

def test_lookup():
nomorobo = NomoroboService()
result = nomorobo.lookup_number("5622862616")
pprint(result)
assert result["spam"]

result = nomorobo.lookup_number("1234567890")
pprint(result)
assert not result.get("spam")

0 comments on commit 297d8f5

Please sign in to comment.