def test_get_csrf_token(self): responses.add(** mock.jboss_fp) res = requests.get(mock.jboss_fp['url']) cred = self.get_cred(self.jboss_name) assert cred['name'] == self.jboss_name csrf = changeme.get_csrf_token(res, cred) assert csrf == 'foobar'
def test_get_csrf_token(self): responses.add(**mock.jboss_fp) res = requests.get(mock.jboss_fp['url']) cred = self.get_cred(self.jboss_name) assert cred['name'] == self.jboss_name csrf = changeme.get_csrf_token(res, cred) assert csrf == 'foobar'
def test_get_csrf_token_no_token(self): responses.add(** mock.zabbix_fp) res = requests.get(mock.zabbix_fp['url']) cred = self.get_cred('Zabbix') assert cred['name'] == 'Zabbix' csrf = changeme.get_csrf_token(res, cred) assert csrf is False matches = changeme.get_fingerprint_matches(res, self.creds) assert len(matches) == 1
def test_get_csrf_token_no_token(self): responses.add(**mock.zabbix_fp) res = requests.get(mock.zabbix_fp['url']) cred = self.get_cred('Zabbix') assert cred['name'] == 'Zabbix' csrf = changeme.get_csrf_token(res, cred) assert csrf is False matches = changeme.get_fingerprint_matches(res, self.creds) assert len(matches) == 1
def test_get_csrf_token_fail(self): orig = mock.jboss_fp['body'] mock.jboss_fp['body'] = "foobar" responses.add(**mock.jboss_fp) mock.jboss_fp['body'] = orig res = requests.get(mock.jboss_fp['url']) cred = self.get_cred(self.jboss_name) assert cred['name'] == self.jboss_name csrf = changeme.get_csrf_token(res, cred) assert csrf is False
def test_get_csrf_token_fail(self): orig = mock.jboss_fp['body'] mock.jboss_fp['body'] = "foobar" responses.add(** mock.jboss_fp) mock.jboss_fp['body'] = orig res = requests.get(mock.jboss_fp['url']) cred = self.get_cred(self.jboss_name) assert cred['name'] == self.jboss_name csrf = changeme.get_csrf_token(res, cred) assert csrf is False