def test_good_login(self): self.config = tcmodemstats.Config() scraper = tcmodemstats.Scraper(host=self.config.tcmodem_host, username=self.config.tcmodem_username, password=self.config.tcmodem_password) login_result = scraper.login() assert login_result == 200
def test_bad_login(self): self.config = tcmodemstats.Config() with pytest.raises(ValueError) as excinfo: scraper = tcmodemstats.Scraper(host=self.config.tcmodem_host, username="******", password="******") assert str(excinfo.value) == "Username or password not correct"
def test_default_config_filename(self): config = tcmodemstats.Config() assert config.config_filename == "config.yaml"
def test_non_existent_key(self): config = tcmodemstats.Config() assert config.key == None
def test_key(self): config = tcmodemstats.Config() os.environ["pytest_tcmodemstats_testkey"] = "testvalue" assert config.pytest_tcmodemstats_testkey == os.getenv( "pytest_tcmodemstats_testkey")
def test_custom_config_filename(self): config = tcmodemstats.Config("custom") assert config.config_filename == "custom"