Пример #1
0
    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
Пример #2
0
    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"
Пример #3
0
 def test_default_config_filename(self):
     config = tcmodemstats.Config()
     assert config.config_filename == "config.yaml"
Пример #4
0
 def test_non_existent_key(self):
     config = tcmodemstats.Config()
     assert config.key == None
Пример #5
0
 def test_key(self):
     config = tcmodemstats.Config()
     os.environ["pytest_tcmodemstats_testkey"] = "testvalue"
     assert config.pytest_tcmodemstats_testkey == os.getenv(
         "pytest_tcmodemstats_testkey")
Пример #6
0
 def test_custom_config_filename(self):
     config = tcmodemstats.Config("custom")
     assert config.config_filename == "custom"