示例#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"