Ejemplo n.º 1
0
    def test_with_more_than_10_invalid_dates(self, httpserver):
        httpserver.serve_content(open('./fixtures/lotw_data_with_errors.html').read())

        with pytest.raises(ValueError):
            get_lotw_users(url=httpserver.url)

            
            
Ejemplo n.º 2
0
    def test_download_lotw_list_and_check_types(self):

        data = get_lotw_users()
        assert isinstance(data, dict)
        for key, value in iteritems(data):
            assert isinstance(key, unicode)
            assert isinstance(value, datetime.datetime )
        assert len(data) > 1000
Ejemplo n.º 3
0
    def test_with_more_than_10_invalid_dates(self, httpserver):
        httpserver.serve_content(open(os.path.join(fix_dir, 'lotw_data_with_errors.html')).read())

        with pytest.raises(ValueError):
            get_lotw_users(url=httpserver.url)
Ejemplo n.º 4
0
 def test_with_invalid_url(self):
     with pytest.raises(IOError):
         get_lotw_users(url="https://lotw.arrl.org/lotw-user-activity_FAKE.csv")
Ejemplo n.º 5
0
    def test_check_content_with_mocked_http_server(self, httpserver):
        httpserver.serve_content(open(os.path.join(fix_dir, 'lotw-user-activity.csv')).read())

        namespace = {}
        execfile(os.path.join(fix_dir,"lotw_fixture.py"), namespace)
        assert get_lotw_users(url=httpserver.url) == namespace['lotw_fixture']
Ejemplo n.º 6
0
    def test_check_content_with_mocked_http_server(self, httpserver):
        httpserver.serve_content(
            open('./fixtures/lotw-user-activity.csv').read())

        exec(open(os.path.join("./fixtures/", "lotw_fixture.py")).read())
        assert get_lotw_users(url=httpserver.url) == lotw_fixture
Ejemplo n.º 7
0
from pyhamtools.qsl import get_lotw_users

lotw = get_lotw_users()
print lotw
# pipe output into file
Ejemplo n.º 8
0
 def test_check_content_with_mocked_http_server(self, httpserver):
     httpserver.serve_content(open('./fixtures/lotw_data.html').read())
     
     exec(open(os.path.join("./fixtures/","lotw_data.py")).read())
     assert get_lotw_users(url=httpserver.url) == lotw_fixture
Ejemplo n.º 9
0
 def test_with_invalid_url(self):
     with pytest.raises(IOError):
         get_lotw_users(url="http://wd5eae.org/LoTW_Data_XXXXX.txt")