<s> from pyiso import client_factory <EOL> from unittest import TestCase <EOL> from datetime import datetime <EOL> import mock <EOL> import pytz <EOL> class TestEU ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . c = client_factory ( '<STR_LIT>' ) <EOL> def test_auth ( self ) : <EOL> self . assertTrue ( self . c . auth ( ) ) <EOL> def test_auth_wrongemail ( self ) : <EOL> self . c . session = mock . MagicMock ( ) <EOL> response = mock . MagicMock ( ) <EOL> response . text = '<STR_LIT>' <EOL> self . c . session . post . return_value = response <EOL> r = self . c . auth ( ) <EOL> self . assertEqual ( r , '<STR_LIT>' ) <EOL> def test_auth_suspended ( self ) : <EOL> self . c . session = mock . MagicMock ( ) <EOL> response = mock . MagicMock ( ) <EOL> response . text = '<STR_LIT>' <EOL> self . c . session . post . return_value = response <EOL> r = self . c . auth ( ) <EOL> self . assertEqual ( r , '<STR_LIT>' ) <EOL> def test_auth_nothuman ( self ) : <EOL> self . c . session = mock . MagicMock ( ) <EOL> response = mock . MagicMock ( ) <EOL> response . text = '<STR_LIT>' <EOL> self . c . session . post . return_value = response <EOL> r = self . c . auth ( ) <EOL> self . assertEqual ( r , '<STR_LIT>' ) <EOL> def test_auth_unknown ( self ) : <EOL> self . c . session = mock . MagicMock ( ) <EOL> response = mock . MagicMock ( ) <EOL> response . text = '<STR_LIT>' <EOL> self . c . session . post . return_value = response <EOL> r = self . c . auth ( ) <EOL> self . assertIn ( '<STR_LIT>' , r ) <EOL> def test_throttled ( self ) : <EOL> self . c . session = mock . MagicMock ( ) <EOL> response = mock . MagicMock ( ) <EOL> response . text = '<STR_LIT>' <EOL> self . c . session . get . return_value = response <EOL> r = self . c . fetch_entsoe ( '<STR_LIT:url>' , '<STR_LIT>' ) <EOL> self . assertFalse ( r ) <EOL> def test_unknownexception ( self ) : <EOL> self . c . session = mock . MagicMock ( ) <EOL> response = mock . MagicMock ( ) <EOL> response . text = '<STR_LIT>' <EOL> self . c . session . get . return_value = response <EOL> r = self . c . fetch_entsoe ( '<STR_LIT:url>' , '<STR_LIT>' ) <EOL> self . assertFalse ( r ) <EOL> def test_bad_control_area ( self ) : <EOL> self . assertRaises ( ValueError , self . c . get_load , '<STR_LIT>' , latest = True ) </s>
